On Wed, 2014-04-09 at 22:53 +0100, Hin-Tak Leung wrote: [snip] > @@ -127,7 +128,7 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) > struct inode *inode = file_inode(file); > struct super_block *sb = inode->i_sb; > int len, err; > - char strbuf[HFSPLUS_MAX_STRLEN + 1]; > + char *strbuf; > hfsplus_cat_entry entry; > struct hfs_find_data fd; > struct hfsplus_readdir_data *rd; > @@ -139,6 +140,11 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) > err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); > if (err) > return err; > + strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_MAX_STRLEN + 1, GFP_KERNEL); I think that if you use kzalloc for second case then it makes sense to use kzalloc and here. Anyway, kzalloc can be much more safe way, from my viewpoint. [snip] > diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c > index 4e27edc..3034ce6 100644 > --- a/fs/hfsplus/xattr.c > +++ b/fs/hfsplus/xattr.c > @@ -8,6 +8,7 @@ > > > + strbuf = kzalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + > + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); > + if (!strbuf) { > + res = -ENOMEM; > + goto out; > + } > + Thanks, Vyacheslav Dubeyko. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html