Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

exfat: replace memcpy with structure assignment

Use structure assignment instead of memcpy.

Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>

authored by

Tetsuhiro Kohada and committed by
Namjae Jeon
a7a24168 6c958a09

+10 -14
+2 -5
fs/exfat/dir.c
··· 978 978 if (ei->hint_femp.eidx == 979 979 EXFAT_HINT_NONE || 980 980 candi_empty.eidx <= 981 - ei->hint_femp.eidx) { 982 - memcpy(&ei->hint_femp, 983 - &candi_empty, 984 - sizeof(candi_empty)); 985 - } 981 + ei->hint_femp.eidx) 982 + ei->hint_femp = candi_empty; 986 983 } 987 984 988 985 brelse(bh);
+1 -1
fs/exfat/inode.c
··· 556 556 struct exfat_inode_info *ei = EXFAT_I(inode); 557 557 loff_t size = info->size; 558 558 559 - memcpy(&ei->dir, &info->dir, sizeof(struct exfat_chain)); 559 + ei->dir = info->dir; 560 560 ei->entry = info->entry; 561 561 ei->attr = info->attr; 562 562 ei->start_clu = info->start_clu;
+7 -8
fs/exfat/namei.c
··· 318 318 hint_femp.eidx = EXFAT_HINT_NONE; 319 319 320 320 if (ei->hint_femp.eidx != EXFAT_HINT_NONE) { 321 - memcpy(&hint_femp, &ei->hint_femp, 322 - sizeof(struct exfat_hint_femp)); 321 + hint_femp = ei->hint_femp; 323 322 ei->hint_femp.eidx = EXFAT_HINT_NONE; 324 323 } 325 324 ··· 518 519 if (ret) 519 520 goto out; 520 521 521 - memcpy(&info->dir, p_dir, sizeof(struct exfat_chain)); 522 + info->dir = *p_dir; 522 523 info->entry = dentry; 523 524 info->flags = ALLOC_NO_FAT_CHAIN; 524 525 info->type = type; ··· 624 625 if (dentry < 0) 625 626 return dentry; /* -error value */ 626 627 627 - memcpy(&info->dir, &cdir.dir, sizeof(struct exfat_chain)); 628 + info->dir = cdir; 628 629 info->entry = dentry; 629 630 info->num_subdirs = 0; 630 631 ··· 1029 1030 if (!epnew) 1030 1031 return -EIO; 1031 1032 1032 - memcpy(epnew, epold, DENTRY_SIZE); 1033 + *epnew = *epold; 1033 1034 if (exfat_get_entry_type(epnew) == TYPE_FILE) { 1034 1035 epnew->dentry.file.attr |= cpu_to_le16(ATTR_ARCHIVE); 1035 1036 ei->attr |= ATTR_ARCHIVE; ··· 1049 1050 return -EIO; 1050 1051 } 1051 1052 1052 - memcpy(epnew, epold, DENTRY_SIZE); 1053 + *epnew = *epold; 1053 1054 exfat_update_bh(new_bh, sync); 1054 1055 brelse(old_bh); 1055 1056 brelse(new_bh); ··· 1117 1118 if (!epnew) 1118 1119 return -EIO; 1119 1120 1120 - memcpy(epnew, epmov, DENTRY_SIZE); 1121 + *epnew = *epmov; 1121 1122 if (exfat_get_entry_type(epnew) == TYPE_FILE) { 1122 1123 epnew->dentry.file.attr |= cpu_to_le16(ATTR_ARCHIVE); 1123 1124 ei->attr |= ATTR_ARCHIVE; ··· 1137 1138 return -EIO; 1138 1139 } 1139 1140 1140 - memcpy(epnew, epmov, DENTRY_SIZE); 1141 + *epnew = *epmov; 1141 1142 exfat_update_bh(new_bh, IS_DIRSYNC(inode)); 1142 1143 brelse(mov_bh); 1143 1144 brelse(new_bh);