All of lore.kernel.org
 help / color / mirror / Atom feed
* + cifs-check-for-granted-memory.patch added to -mm tree
@ 2007-08-17 21:50 akpm
  2007-08-17 22:17 ` Jesper Juhl
  0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2007-08-17 21:50 UTC (permalink / raw)
  To: mm-commits; +Cc: gorcunov, sfrench


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 <gorcunov@gmail.com>

Add a check for granted memory to prevent possible NULL pointer usage.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 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;
+	}
 	bcc_ptr = str_area;
 
 	ses->flags &= ~CIFS_SES_LANMAN;
_

Patches currently in -mm which might be from gorcunov@gmail.com are

cifs-check-for-granted-memory.patch
sky-cpu-and-nexus-code-style-improvement.patch
sky-cpu-and-nexus-include-ioh.patch
sky-cpu-and-nexus-check-for-platform_get_resource-ret.patch
sky-cpu-and-nexus-check-for-create_proc_entry-ret-code.patch
sky-cpu-use-c99-style-for-struct-init.patch
sky-cpu-and-nexus-get-rid-of-useless-null-init.patch
sky-cpu-and-nexus-use-seq_file-single_open-on-proc-interface.patch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + cifs-check-for-granted-memory.patch added to -mm tree
  2007-08-17 21:50 + cifs-check-for-granted-memory.patch added to -mm tree akpm
@ 2007-08-17 22:17 ` Jesper Juhl
  2007-08-18  3:42   ` Cyrill Gorcunov
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2007-08-17 22:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: mm-commits, gorcunov, sfrench

On 17/08/07, akpm@linux-foundation.org <akpm@linux-foundation.org> 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 <gorcunov@gmail.com>
>
> Add a check for granted memory to prevent possible NULL pointer usage.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Steven French <sfrench@us.ibm.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
>  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 <jesper.juhl@gmail.com>
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + cifs-check-for-granted-memory.patch added to -mm tree
  2007-08-17 22:17 ` Jesper Juhl
@ 2007-08-18  3:42   ` Cyrill Gorcunov
  0 siblings, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2007-08-18  3:42 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, sfrench

[Jesper Juhl - Sat, Aug 18, 2007 at 12:17:33AM +0200]
| On 17/08/07, akpm@linux-foundation.org <akpm@linux-foundation.org> 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 <gorcunov@gmail.com>
| >
| > Add a check for granted memory to prevent possible NULL pointer usage.
| >
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > Cc: Steven French <sfrench@us.ibm.com>
| > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
| > ---
| >
| >  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 <jesper.juhl@gmail.com>
| 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-18  3:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-17 21:50 + cifs-check-for-granted-memory.patch added to -mm tree akpm
2007-08-17 22:17 ` Jesper Juhl
2007-08-18  3:42   ` Cyrill Gorcunov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.