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

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: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

Markus Elfring and committed by
Jan Kara
033c9da0 ba2eb866

+6 -7
+3 -3
fs/udf/inode.c
··· 114 114 __udf_clear_extent_cache(inode); 115 115 if (pos->bh) 116 116 get_bh(pos->bh); 117 - memcpy(&iinfo->cached_extent.epos, pos, sizeof(struct extent_position)); 117 + memcpy(&iinfo->cached_extent.epos, pos, sizeof(*pos)); 118 118 iinfo->cached_extent.lstart = estart; 119 119 switch (iinfo->i_alloc_type) { 120 120 case ICBTAG_FLAG_AD_SHORT: ··· 1703 1703 dsea->impUseLength = cpu_to_le32(sizeof(struct regid)); 1704 1704 } 1705 1705 eid = (struct regid *)dsea->impUse; 1706 - memset(eid, 0, sizeof(struct regid)); 1706 + memset(eid, 0, sizeof(*eid)); 1707 1707 strcpy(eid->ident, UDF_ID_DEVELOPER); 1708 1708 eid->identSuffix[0] = UDF_OS_CLASS_UNIX; 1709 1709 eid->identSuffix[1] = UDF_OS_ID_LINUX; ··· 1754 1754 udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime); 1755 1755 udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime); 1756 1756 1757 - memset(&(efe->impIdent), 0, sizeof(struct regid)); 1757 + memset(&(efe->impIdent), 0, sizeof(efe->impIdent)); 1758 1758 strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); 1759 1759 efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1760 1760 efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
+1 -1
fs/udf/namei.c
··· 1184 1184 */ 1185 1185 ncfi.fileVersionNum = ocfi.fileVersionNum; 1186 1186 ncfi.fileCharacteristics = ocfi.fileCharacteristics; 1187 - memcpy(&(ncfi.icb), &(ocfi.icb), sizeof(struct long_ad)); 1187 + memcpy(&(ncfi.icb), &(ocfi.icb), sizeof(ocfi.icb)); 1188 1188 udf_write_fi(new_dir, &ncfi, nfi, &nfibh, NULL, NULL); 1189 1189 1190 1190 /* The old fid may have moved - find it again */
+2 -3
fs/udf/super.c
··· 266 266 { 267 267 struct udf_sb_info *sbi = UDF_SB(sb); 268 268 269 - sbi->s_partmaps = kcalloc(count, sizeof(struct udf_part_map), 270 - GFP_KERNEL); 269 + sbi->s_partmaps = kcalloc(count, sizeof(*sbi->s_partmaps), GFP_KERNEL); 271 270 if (!sbi->s_partmaps) { 272 271 udf_err(sb, "Unable to allocate space for %d partition maps\n", 273 272 count); ··· 2099 2100 uopt.fmode = UDF_INVALID_MODE; 2100 2101 uopt.dmode = UDF_INVALID_MODE; 2101 2102 2102 - sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); 2103 + sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 2103 2104 if (!sbi) 2104 2105 return -ENOMEM; 2105 2106