[PATCH][2.5] CIFS cifsfs.c check kmalloc return

Zwane Mwaikambo (zwane@linuxpower.ca)
Wed, 16 Oct 2002 00:22:40 -0400 (EDT)


Index: linux-2.5.43/fs/cifs/cifsfs.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.43/fs/cifs/cifsfs.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cifsfs.c
--- linux-2.5.43/fs/cifs/cifsfs.c 16 Oct 2002 03:46:04 -0000 1.1.1.1
+++ linux-2.5.43/fs/cifs/cifsfs.c 16 Oct 2002 04:20:34 -0000
@@ -64,8 +64,11 @@
struct cifs_sb_info *cifs_sb;
int rc = 0;

- sb->s_fs_info = kmalloc(sizeof(struct cifs_sb_info),GFP_KERNEL);
+ sb->s_fs_info = kmalloc(sizeof(struct cifs_sb_info),GFP_KERNEL);
cifs_sb = CIFS_SB(sb);
+ if (cifs_sb == NULL)
+ return -ENOMEM;
+
cifs_sb->local_nls = load_nls_default(); /* needed for ASCII cp to Unicode converts */
rc = cifs_mount(sb, cifs_sb, data, devname);

-- 
function.linuxpower.ca

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/