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