OSDN Git Service

fs/cifs/smb2file.c: replace count*size kzalloc by kcalloc
authorFabian Frederick <fabf@skynet.be>
Wed, 10 Dec 2014 23:41:20 +0000 (15:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Dec 2014 01:41:02 +0000 (17:41 -0800)
kcalloc manages count*sizeof overflow.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Steve French <sfrench@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/cifs/smb2file.c

index 4599294..7198eac 100644 (file)
@@ -111,7 +111,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
                return -EINVAL;
 
        max_num = max_buf / sizeof(struct smb2_lock_element);
-       buf = kzalloc(max_num * sizeof(struct smb2_lock_element), GFP_KERNEL);
+       buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
@@ -247,7 +247,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
        }
 
        max_num = max_buf / sizeof(struct smb2_lock_element);
-       buf = kzalloc(max_num * sizeof(struct smb2_lock_element), GFP_KERNEL);
+       buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL);
        if (!buf) {
                free_xid(xid);
                return -ENOMEM;