浏览代码

orangefs: switch decode_dirents() to use of kcalloc()

gets rid of multiplication overflow

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Al Viro 10 年之前
父节点
当前提交
ef4af94edc
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      fs/orangefs/dir.c

+ 1 - 1
fs/orangefs/dir.c

@@ -27,7 +27,7 @@ static long decode_dirents(char *ptr, struct pvfs2_readdir_response_s *readdir)
 
 
 	readdir->token = rd->token;
 	readdir->token = rd->token;
 	readdir->pvfs_dirent_outcount = rd->pvfs_dirent_outcount;
 	readdir->pvfs_dirent_outcount = rd->pvfs_dirent_outcount;
-	readdir->dirent_array = kmalloc(readdir->pvfs_dirent_outcount *
+	readdir->dirent_array = kcalloc(readdir->pvfs_dirent_outcount,
 					sizeof(*readdir->dirent_array),
 					sizeof(*readdir->dirent_array),
 					GFP_KERNEL);
 					GFP_KERNEL);
 	if (readdir->dirent_array == NULL)
 	if (readdir->dirent_array == NULL)