提交 033c9da0 编写于 作者: M Markus Elfring 提交者: Jan Kara

fs-udf: Improve six size determinations

Replace the specification of data structures by variable references
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: NJan Kara <jack@suse.cz>
上级 ba2eb866
...@@ -114,7 +114,7 @@ static void udf_update_extent_cache(struct inode *inode, loff_t estart, ...@@ -114,7 +114,7 @@ static void udf_update_extent_cache(struct inode *inode, loff_t estart,
__udf_clear_extent_cache(inode); __udf_clear_extent_cache(inode);
if (pos->bh) if (pos->bh)
get_bh(pos->bh); get_bh(pos->bh);
memcpy(&iinfo->cached_extent.epos, pos, sizeof(struct extent_position)); memcpy(&iinfo->cached_extent.epos, pos, sizeof(*pos));
iinfo->cached_extent.lstart = estart; iinfo->cached_extent.lstart = estart;
switch (iinfo->i_alloc_type) { switch (iinfo->i_alloc_type) {
case ICBTAG_FLAG_AD_SHORT: case ICBTAG_FLAG_AD_SHORT:
...@@ -1703,7 +1703,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) ...@@ -1703,7 +1703,7 @@ static int udf_update_inode(struct inode *inode, int do_sync)
dsea->impUseLength = cpu_to_le32(sizeof(struct regid)); dsea->impUseLength = cpu_to_le32(sizeof(struct regid));
} }
eid = (struct regid *)dsea->impUse; eid = (struct regid *)dsea->impUse;
memset(eid, 0, sizeof(struct regid)); memset(eid, 0, sizeof(*eid));
strcpy(eid->ident, UDF_ID_DEVELOPER); strcpy(eid->ident, UDF_ID_DEVELOPER);
eid->identSuffix[0] = UDF_OS_CLASS_UNIX; eid->identSuffix[0] = UDF_OS_CLASS_UNIX;
eid->identSuffix[1] = UDF_OS_ID_LINUX; eid->identSuffix[1] = UDF_OS_ID_LINUX;
...@@ -1754,7 +1754,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) ...@@ -1754,7 +1754,7 @@ static int udf_update_inode(struct inode *inode, int do_sync)
udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime); udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime);
udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime); udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime);
memset(&(efe->impIdent), 0, sizeof(struct regid)); memset(&(efe->impIdent), 0, sizeof(efe->impIdent));
strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER);
efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
......
...@@ -1184,7 +1184,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1184,7 +1184,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
*/ */
ncfi.fileVersionNum = ocfi.fileVersionNum; ncfi.fileVersionNum = ocfi.fileVersionNum;
ncfi.fileCharacteristics = ocfi.fileCharacteristics; ncfi.fileCharacteristics = ocfi.fileCharacteristics;
memcpy(&(ncfi.icb), &(ocfi.icb), sizeof(struct long_ad)); memcpy(&(ncfi.icb), &(ocfi.icb), sizeof(ocfi.icb));
udf_write_fi(new_dir, &ncfi, nfi, &nfibh, NULL, NULL); udf_write_fi(new_dir, &ncfi, nfi, &nfibh, NULL, NULL);
/* The old fid may have moved - find it again */ /* The old fid may have moved - find it again */
......
...@@ -266,8 +266,7 @@ static int udf_sb_alloc_partition_maps(struct super_block *sb, u32 count) ...@@ -266,8 +266,7 @@ static int udf_sb_alloc_partition_maps(struct super_block *sb, u32 count)
{ {
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
sbi->s_partmaps = kcalloc(count, sizeof(struct udf_part_map), sbi->s_partmaps = kcalloc(count, sizeof(*sbi->s_partmaps), GFP_KERNEL);
GFP_KERNEL);
if (!sbi->s_partmaps) { if (!sbi->s_partmaps) {
udf_err(sb, "Unable to allocate space for %d partition maps\n", udf_err(sb, "Unable to allocate space for %d partition maps\n",
count); count);
...@@ -2100,7 +2099,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -2100,7 +2099,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
uopt.fmode = UDF_INVALID_MODE; uopt.fmode = UDF_INVALID_MODE;
uopt.dmode = UDF_INVALID_MODE; uopt.dmode = UDF_INVALID_MODE;
sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册