lkml.org 
[lkml]   [2010]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 10/15] fs: cifs: check kmalloc() result
From
Date
On Fri, 2010-07-16 at 20:15 +0400, Kulikov Vasiliy wrote:
> If kmalloc() fails exit with -ENOMEM.

Looks good to me. Add my ack if you want it.

> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>

Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>

> ---
> fs/cifs/readdir.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
> index daf1753..d5e591f 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 */

--
Dave Kleikamp
IBM Linux Technology Center



\
 
 \ /
  Last update: 2010-07-16 18:37    [W:0.060 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site