From e2ffcf5c7ee7eb979b1f2375404668a2f5076c1b Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Fri, 8 Aug 2014 14:22:22 -0700 Subject: fs/adfs/dir_fplus.c: use ARRAY_SIZE instead of sizeof/sizeof[0] Use kernel.h definition. Signed-off-by: Fabian Frederick Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/adfs/dir_fplus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/adfs/dir_fplus.c') diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c index d9e3bee4e653..7673c1fdbfc0 100644 --- a/fs/adfs/dir_fplus.c +++ b/fs/adfs/dir_fplus.c @@ -55,7 +55,7 @@ adfs_fplus_read(struct super_block *sb, unsigned int id, unsigned int sz, struct } size >>= sb->s_blocksize_bits; - if (size > sizeof(dir->bh)/sizeof(dir->bh[0])) { + if (size > ARRAY_SIZE(dir->bh)) { /* this directory is too big for fixed bh set, must allocate */ struct buffer_head **bh_fplus = kzalloc(size * sizeof(struct buffer_head *), -- cgit v1.2.3 From b16214d43d9060722360360f741416660b54c4f5 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Fri, 8 Aug 2014 14:22:24 -0700 Subject: fs/adfs/dir_fplus.c: replace count*size kzalloc by kcalloc kcalloc manages count*sizeof overflow. Signed-off-by: Fabian Frederick Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/adfs/dir_fplus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/adfs/dir_fplus.c') diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c index 7673c1fdbfc0..c52f1ce15f1e 100644 --- a/fs/adfs/dir_fplus.c +++ b/fs/adfs/dir_fplus.c @@ -58,7 +58,7 @@ adfs_fplus_read(struct super_block *sb, unsigned int id, unsigned int sz, struct if (size > ARRAY_SIZE(dir->bh)) { /* this directory is too big for fixed bh set, must allocate */ struct buffer_head **bh_fplus = - kzalloc(size * sizeof(struct buffer_head *), + kcalloc(size, sizeof(struct buffer_head *), GFP_KERNEL); if (!bh_fplus) { adfs_error(sb, "not enough memory for" -- cgit v1.2.3 From 19bdd41a57e1418b8661148125e9b6d99f468c1b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 8 Aug 2014 14:22:26 -0700 Subject: adfs: add __printf verification, fix format/argument mismatches Might as well do the right thing. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/adfs/dir_fplus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'fs/adfs/dir_fplus.c') diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c index c52f1ce15f1e..f2ba88ab4aed 100644 --- a/fs/adfs/dir_fplus.c +++ b/fs/adfs/dir_fplus.c @@ -79,9 +79,8 @@ adfs_fplus_read(struct super_block *sb, unsigned int id, unsigned int sz, struct dir->bh_fplus[blk] = sb_bread(sb, block); if (!dir->bh_fplus[blk]) { - adfs_error(sb, "dir object %X failed read for" - " offset %d, mapped block %X", - id, blk, block); + adfs_error(sb, "dir object %x failed read for offset %d, mapped block %lX", + id, blk, block); goto out; } -- cgit v1.2.3