[PATCH][PPP] ppp_generic: Add checks for NULL pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




This patch adds two checks for NULL pointers.

Signed-off-by: Youssef Hmamouche <[email protected]>



--- 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux