public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][ACPI] toshiba_acpi.c: add check for NULL pointer
@ 2005-08-04  6:08 Hmamouche, Youssef
  2005-08-04  6:39 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: Hmamouche, Youssef @ 2005-08-04  6:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: toshiba_acpi, youssef


This patch adds a check for NULL return from kmalloc.

Signed-off-by: Youssef Hmamouche <hyoussef@gmail.com>



--- a/drivers/acpi/toshiba_acpi.c       2005-07-15 14:18:57.000000000 -0700
+++ b/drivers/acpi/toshiba_acpi.c       2005-08-03 21:35:12.000000000 -0700
@@ -263,6 +263,9 @@
          * destination so that sscanf can be used on it safely.
          */
         tmp_buffer = kmalloc(count + 1, GFP_KERNEL);
+       if(tmp_buffer == NULL) {
+               return -ENOMEM;
+       }
         if (copy_from_user(tmp_buffer, buffer, count)) {
                 result = -EFAULT;
         }

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

* Re: [PATCH][ACPI] toshiba_acpi.c: add check for NULL pointer
  2005-08-04  6:08 [PATCH][ACPI] toshiba_acpi.c: add check for NULL pointer Hmamouche, Youssef
@ 2005-08-04  6:39 ` Pekka Enberg
  0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2005-08-04  6:39 UTC (permalink / raw)
  To: youssef; +Cc: linux-kernel, toshiba_acpi

On 8/4/05, Hmamouche, Youssef <youssef@ece.utexas.edu> wrote:
> --- a/drivers/acpi/toshiba_acpi.c       2005-07-15 14:18:57.000000000 -0700
> +++ b/drivers/acpi/toshiba_acpi.c       2005-08-03 21:35:12.000000000 -0700
> @@ -263,6 +263,9 @@
>           * destination so that sscanf can be used on it safely.
>           */
>          tmp_buffer = kmalloc(count + 1, GFP_KERNEL);
> +       if(tmp_buffer == NULL) {
> +               return -ENOMEM;
> +       }

Already fixed in 2.6.13-rc4-mm1.

                                  Pekka

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

end of thread, other threads:[~2005-08-04  6:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-04  6:08 [PATCH][ACPI] toshiba_acpi.c: add check for NULL pointer Hmamouche, Youssef
2005-08-04  6:39 ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox