Re: + cifs-check-for-granted-memory.patch added to -mm tree

2007-08-17 Thread Cyrill Gorcunov
[Jesper Juhl - Sat, Aug 18, 2007 at 12:17:33AM +0200]
| On 17/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
| >
| > The patch titled
| >  CIFS: check for granted memory
| > has been added to the -mm tree.  Its filename is
| >  cifs-check-for-granted-memory.patch
| >
| > *** Remember to use Documentation/SubmitChecklist when testing your code ***
| >
| > See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
| > out what to do about this
| >
| > --
| > Subject: CIFS: check for granted memory
| > From: Cyrill Gorcunov <[EMAIL PROTECTED]>
| >
| > Add a check for granted memory to prevent possible NULL pointer usage.
| >
| > Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]>
| > Cc: Steven French <[EMAIL PROTECTED]>
| > Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
| > ---
| >
| >  fs/cifs/sess.c |4 
| >  1 files changed, 4 insertions(+)
| >
| > diff -puN fs/cifs/sess.c~cifs-check-for-granted-memory fs/cifs/sess.c
| > --- a/fs/cifs/sess.c~cifs-check-for-granted-memory
| > +++ a/fs/cifs/sess.c
| > @@ -372,6 +372,10 @@ CIFS_SessSetup(unsigned int xid, struct
| >
| > /* 2000 big enough to fit max user, domain, NOS name etc. */
| > str_area = kmalloc(2000, GFP_KERNEL);
| > +   if (str_area == NULL) {
| > +   cifs_small_buf_release(smb_buf);
| > +   return -ENOMEM;
| > +   }
| 
| The patch, as such, is fine - not arguing against it, but as a matter
| of style; don't we usually prefer the "if (!foo)" form over "if (foo
| == NULL)" ??

I just don't wanna mess 'if (!ptr)' and 'if (ptr == NULL)'
in the procedure. Look at the code ;) Some procs in CIFS
_does_ use '!ptr' but others - 'ptr == NULL'. So in the
proc being patched 'if (ptr == NULL)' is assumed.

| 
| -- 
| Jesper Juhl <[EMAIL PROTECTED]>
| Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
| Plain text mails only, please  http://www.expita.com/nomime.html
| 


Cyrill

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


Re: + cifs-check-for-granted-memory.patch added to -mm tree

2007-08-17 Thread Jesper Juhl
On 17/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> The patch titled
>  CIFS: check for granted memory
> has been added to the -mm tree.  Its filename is
>  cifs-check-for-granted-memory.patch
>
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>
> See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
> out what to do about this
>
> --
> Subject: CIFS: check for granted memory
> From: Cyrill Gorcunov <[EMAIL PROTECTED]>
>
> Add a check for granted memory to prevent possible NULL pointer usage.
>
> Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]>
> Cc: Steven French <[EMAIL PROTECTED]>
> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
> ---
>
>  fs/cifs/sess.c |4 
>  1 files changed, 4 insertions(+)
>
> diff -puN fs/cifs/sess.c~cifs-check-for-granted-memory fs/cifs/sess.c
> --- a/fs/cifs/sess.c~cifs-check-for-granted-memory
> +++ a/fs/cifs/sess.c
> @@ -372,6 +372,10 @@ CIFS_SessSetup(unsigned int xid, struct
>
> /* 2000 big enough to fit max user, domain, NOS name etc. */
> str_area = kmalloc(2000, GFP_KERNEL);
> +   if (str_area == NULL) {
> +   cifs_small_buf_release(smb_buf);
> +   return -ENOMEM;
> +   }

The patch, as such, is fine - not arguing against it, but as a matter
of style; don't we usually prefer the "if (!foo)" form over "if (foo
== NULL)" ??

-- 
Jesper Juhl <[EMAIL PROTECTED]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please  http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/