staging: lustre: check kzalloc return value
authorGujulan Elango, Hari Prasath (H.) <hgujulan@visteon.com>
Wed, 13 May 2015 10:36:28 +0000 (10:36 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 00:19:37 +0000 (09:19 +0900)
check the return value of kzalloc before accessing the memory pointer

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/llite_lib.c

index 61acc70aaae4f3b28e355a187487ef677063fbae..e759da3a1b5e2d86c0ff4a785b119a1b08b59234 100644 (file)
@@ -284,6 +284,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                char *buf;
 
                buf = kzalloc(PAGE_CACHE_SIZE, GFP_KERNEL);
+               if (!buf) {
+                       err = -ENOMEM;
+                       goto out_md_fid;
+               }
                obd_connect_flags2str(buf, PAGE_CACHE_SIZE,
                                      valid ^ CLIENT_CONNECT_MDT_REQD, ",");
                LCONSOLE_ERROR_MSG(0x170, "Server %s does not support feature(s) needed for correct operation of this client (%s). Please upgrade server or downgrade client.\n",