lkml.org 
[lkml]   [2005]   [Aug]   [4]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateThu, 4 Aug 2005 01:08:16 -0500 (CDT)
From"Hmamouche, Youssef" <>
Subject[PATCH][PPP] ppp_generic: Add checks for NULL pointers
This patch adds two checks for NULL pointers.

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



--- a/drivers/net/ppp_generic.c 2005-07-15 14:18:57.000000000 -0700
+++ b/drivers/net/ppp_generic.c 2005-08-03 21:11:14.000000000 -0700
@@ -2644,6 +2644,11 @@
                 do {
                         /* need a new top level */
                         struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL);
+                       if(np == NULL) {
+                               printk(KERN_ERR "ppp_generic: Couldn't allocate "
+                                       "memory for cardmap.\n");
+                               continue;
+                       }
                         memset(np, 0, sizeof(*np));
                         np->ptr[0] = p;
                         if (p != NULL) {
@@ -2659,6 +2664,11 @@
                 i = (nr >> p->shift) & CARDMAP_MASK;
                 if (p->ptr[i] == NULL) {
                         struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL);
+                       if(np == NULL) {
+                               printk(KERN_ERR "ppp_generic: Couldn't allocate "
+                                       "memory for cardmap.\n");
+                               continue;
+                       }
                         memset(np, 0, sizeof(*np));
                         np->shift = p->shift - CARDMAP_ORDER;
                         np->parent = p;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-04 08:23    [from the cache]
©2003-2008