|
Kmods SIG |
9e3ffb |
From a7a241686c8f8142afafbd5fa5b9b9b6ea1aa173 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
9e3ffb |
From: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
9e3ffb |
Date: Fri, 11 Sep 2020 13:45:19 +0900
|
|
Kmods SIG |
9e3ffb |
Subject: [Backport a7a241686c8f] exfat: replace memcpy with structure
|
|
Kmods SIG |
9e3ffb |
assignment
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Use structure assignment instead of memcpy.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
9e3ffb |
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
9e3ffb |
---
|
|
Kmods SIG |
9e3ffb |
src/dir.c | 7 ++-----
|
|
Kmods SIG |
9e3ffb |
src/inode.c | 2 +-
|
|
Kmods SIG |
9e3ffb |
src/namei.c | 15 +++++++--------
|
|
Kmods SIG |
9e3ffb |
3 files changed, 10 insertions(+), 14 deletions(-)
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/dir.c b/src/dir.c
|
|
Kmods SIG |
9e3ffb |
index a9b13ae3f325fcbf628657981055b91b5079d5f6..5fa751937932f589c3f633c99ba0efd1aadad57e 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/dir.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/dir.c
|
|
Kmods SIG |
9e3ffb |
@@ -978,11 +978,8 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei,
|
|
Kmods SIG |
9e3ffb |
if (ei->hint_femp.eidx ==
|
|
Kmods SIG |
9e3ffb |
EXFAT_HINT_NONE ||
|
|
Kmods SIG |
9e3ffb |
candi_empty.eidx <=
|
|
Kmods SIG |
9e3ffb |
- ei->hint_femp.eidx) {
|
|
Kmods SIG |
9e3ffb |
- memcpy(&ei->hint_femp,
|
|
Kmods SIG |
9e3ffb |
- &candi_empty,
|
|
Kmods SIG |
9e3ffb |
- sizeof(candi_empty));
|
|
Kmods SIG |
9e3ffb |
- }
|
|
Kmods SIG |
9e3ffb |
+ ei->hint_femp.eidx)
|
|
Kmods SIG |
9e3ffb |
+ ei->hint_femp = candi_empty;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
brelse(bh);
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/inode.c b/src/inode.c
|
|
Kmods SIG |
9e3ffb |
index a6de17cac3dfd5566832da7cbabb5635bb186a1a..109f9b4c40d3119351695e5f84063882b41907f3 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/inode.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/inode.c
|
|
Kmods SIG |
9e3ffb |
@@ -556,7 +556,7 @@ static int exfat_fill_inode(struct inode *inode, struct exfat_dir_entry *info)
|
|
Kmods SIG |
9e3ffb |
struct exfat_inode_info *ei = EXFAT_I(inode);
|
|
Kmods SIG |
9e3ffb |
loff_t size = info->size;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- memcpy(&ei->dir, &info->dir, sizeof(struct exfat_chain));
|
|
Kmods SIG |
9e3ffb |
+ ei->dir = info->dir;
|
|
Kmods SIG |
9e3ffb |
ei->entry = info->entry;
|
|
Kmods SIG |
9e3ffb |
ei->attr = info->attr;
|
|
Kmods SIG |
9e3ffb |
ei->start_clu = info->start_clu;
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/namei.c b/src/namei.c
|
|
Kmods SIG |
9e3ffb |
index 803748946ddbf409693ba0016628cb8d0d1dcf8c..676094f2abe2d13573c7e970cbf595586f46a059 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/namei.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/namei.c
|
|
Kmods SIG |
9e3ffb |
@@ -318,8 +318,7 @@ static int exfat_find_empty_entry(struct inode *inode,
|
|
Kmods SIG |
9e3ffb |
hint_femp.eidx = EXFAT_HINT_NONE;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
if (ei->hint_femp.eidx != EXFAT_HINT_NONE) {
|
|
Kmods SIG |
9e3ffb |
- memcpy(&hint_femp, &ei->hint_femp,
|
|
Kmods SIG |
9e3ffb |
- sizeof(struct exfat_hint_femp));
|
|
Kmods SIG |
9e3ffb |
+ hint_femp = ei->hint_femp;
|
|
Kmods SIG |
9e3ffb |
ei->hint_femp.eidx = EXFAT_HINT_NONE;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
@@ -519,7 +518,7 @@ static int exfat_add_entry(struct inode *inode, const char *path,
|
|
Kmods SIG |
9e3ffb |
if (ret)
|
|
Kmods SIG |
9e3ffb |
goto out;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- memcpy(&info->dir, p_dir, sizeof(struct exfat_chain));
|
|
Kmods SIG |
9e3ffb |
+ info->dir = *p_dir;
|
|
Kmods SIG |
9e3ffb |
info->entry = dentry;
|
|
Kmods SIG |
9e3ffb |
info->flags = ALLOC_NO_FAT_CHAIN;
|
|
Kmods SIG |
9e3ffb |
info->type = type;
|
|
Kmods SIG |
9e3ffb |
@@ -625,7 +624,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
|
|
Kmods SIG |
9e3ffb |
if (dentry < 0)
|
|
Kmods SIG |
9e3ffb |
return dentry; /* -error value */
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- memcpy(&info->dir, &cdir.dir, sizeof(struct exfat_chain));
|
|
Kmods SIG |
9e3ffb |
+ info->dir = cdir;
|
|
Kmods SIG |
9e3ffb |
info->entry = dentry;
|
|
Kmods SIG |
9e3ffb |
info->num_subdirs = 0;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
@@ -1030,7 +1029,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir,
|
|
Kmods SIG |
9e3ffb |
if (!epnew)
|
|
Kmods SIG |
9e3ffb |
return -EIO;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- memcpy(epnew, epold, DENTRY_SIZE);
|
|
Kmods SIG |
9e3ffb |
+ *epnew = *epold;
|
|
Kmods SIG |
9e3ffb |
if (exfat_get_entry_type(epnew) == TYPE_FILE) {
|
|
Kmods SIG |
9e3ffb |
epnew->dentry.file.attr |= cpu_to_le16(ATTR_ARCHIVE);
|
|
Kmods SIG |
9e3ffb |
ei->attr |= ATTR_ARCHIVE;
|
|
Kmods SIG |
9e3ffb |
@@ -1050,7 +1049,7 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir,
|
|
Kmods SIG |
9e3ffb |
return -EIO;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- memcpy(epnew, epold, DENTRY_SIZE);
|
|
Kmods SIG |
9e3ffb |
+ *epnew = *epold;
|
|
Kmods SIG |
9e3ffb |
exfat_update_bh(new_bh, sync);
|
|
Kmods SIG |
9e3ffb |
brelse(old_bh);
|
|
Kmods SIG |
9e3ffb |
brelse(new_bh);
|
|
Kmods SIG |
9e3ffb |
@@ -1118,7 +1117,7 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_olddir,
|
|
Kmods SIG |
9e3ffb |
if (!epnew)
|
|
Kmods SIG |
9e3ffb |
return -EIO;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- memcpy(epnew, epmov, DENTRY_SIZE);
|
|
Kmods SIG |
9e3ffb |
+ *epnew = *epmov;
|
|
Kmods SIG |
9e3ffb |
if (exfat_get_entry_type(epnew) == TYPE_FILE) {
|
|
Kmods SIG |
9e3ffb |
epnew->dentry.file.attr |= cpu_to_le16(ATTR_ARCHIVE);
|
|
Kmods SIG |
9e3ffb |
ei->attr |= ATTR_ARCHIVE;
|
|
Kmods SIG |
9e3ffb |
@@ -1138,7 +1137,7 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_olddir,
|
|
Kmods SIG |
9e3ffb |
return -EIO;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- memcpy(epnew, epmov, DENTRY_SIZE);
|
|
Kmods SIG |
9e3ffb |
+ *epnew = *epmov;
|
|
Kmods SIG |
9e3ffb |
exfat_update_bh(new_bh, IS_DIRSYNC(inode));
|
|
Kmods SIG |
9e3ffb |
brelse(mov_bh);
|
|
Kmods SIG |
9e3ffb |
brelse(new_bh);
|
|
Kmods SIG |
9e3ffb |
--
|
|
Kmods SIG |
9e3ffb |
2.31.1
|
|
Kmods SIG |
9e3ffb |
|