From: Kulikov Vasiliy Date: Fri, 16 Jul 2010 16:15:25 +0000 (+0400) Subject: fs: cifs: check kmalloc() result X-Git-Tag: v2.6.36-rc1~590^2~7 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f55fdcca6bf1c17e86a270a8c0d81c6677c61222;p=karo-tx-linux.git fs: cifs: check kmalloc() result If kmalloc() fails exit with -ENOMEM. Signed-off-by: Kulikov Vasiliy Acked-by: Dave Kleikamp Acked-by: Jeff Layton Signed-off-by: Steve French --- diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index daf1753af674..d5e591fab475 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c @@ -847,6 +847,11 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; tmp_buf = kmalloc(UNICODE_NAME_MAX, GFP_KERNEL); + if (tmp_buf == NULL) { + rc = -ENOMEM; + break; + } + for (i = 0; (i < num_to_fill) && (rc == 0); i++) { if (current_entry == NULL) { /* evaluate whether this case is an error */