All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] [PATCH] drivers/video/fbcmap.c kmalloc audit
@ 2004-01-27 21:37 Leann Ogasawara
  2004-01-27 21:44 ` [Kernel-janitors] [PATCH] drivers/video/vga16fb.c ioremap() and Leann Ogasawara
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Leann Ogasawara @ 2004-01-27 21:37 UTC (permalink / raw)
  To: kernel-janitors

Hi All,

Patch to audit kmalloc()'s and handle errors accordingly.  Thanks,

Leann

diffed against 2.6.2-rc2

=== drivers/video/fbcmap.c 1.9 vs edited ==--- 1.9/drivers/video/fbcmap.c	Mon Mar 31 13:51:12 2003
+++ edited/drivers/video/fbcmap.c	Mon Jan 26 17:38:53 2004
@@ -98,14 +98,14 @@
 	if (!len)
 	    return 0;
 	if (!(cmap->red = kmalloc(size, GFP_ATOMIC)))
-	    return -1;
+	    goto err_red;
 	if (!(cmap->green = kmalloc(size, GFP_ATOMIC)))
-	    return -1;
+	    goto err_green;
 	if (!(cmap->blue = kmalloc(size, GFP_ATOMIC)))
-	    return -1;
+	    goto err_blue;
 	if (transp) {
 	    if (!(cmap->transp = kmalloc(size, GFP_ATOMIC)))
-		return -1;
+		goto err_transp;
 	} else
 	    cmap->transp = NULL;
     }
@@ -113,6 +113,17 @@
     cmap->len = len;
     fb_copy_cmap(fb_default_cmap(len), cmap, 0);
     return 0;
+
+ err_transp:
+    kfree(cmap->blue);
+ err_blue:
+    kfree(cmap->green);
+ err_green:
+    kfree(cmap->red);
+ err_red:
+    cmap->red = cmap->green = cmap->blue = cmap->transp = NULL;
+    cmap->len = 0;
+    return -1;
 }
 
 /**


_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2004-02-18 22:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-27 21:37 [Kernel-janitors] [PATCH] drivers/video/fbcmap.c kmalloc audit Leann Ogasawara
2004-01-27 21:44 ` [Kernel-janitors] [PATCH] drivers/video/vga16fb.c ioremap() and Leann Ogasawara
2004-01-27 21:53 ` [Kernel-janitors] [PATCH] drivers/video/fbcmap.c kmalloc audit Arnaldo Carvalho de Melo
2004-01-27 21:54 ` Daniele Bellucci
2004-01-27 22:05 ` Randy.Dunlap
2004-01-27 22:17 ` Daniele Bellucci
2004-02-06 22:31 ` [Kernel-janitors] [PATCH] drivers/video/radeonfb.c fb_alloc_cmap() Leann Ogasawara
2004-02-06 22:36 ` [Kernel-janitors] [PATCH] drivers/video/cyber2000fb.c Leann Ogasawara
2004-02-06 22:38 ` [Kernel-janitors] [PATCH] drivers/video/vfb.c fb_alloc_cmap() audit Leann Ogasawara
2004-02-06 22:39 ` [Kernel-janitors] [PATCH] drivers/video/vesafb.c fb_alloc_cmap() Leann Ogasawara
2004-02-06 22:41 ` [Kernel-janitors] [PATCH] drivers/video/neofb.c fb_alloc_cmap() Leann Ogasawara
2004-02-06 23:23 ` [Kernel-janitors] [PATCH] drivers/video/radeonfb.c Domen Puncer
2004-02-07 15:37 ` [Kernel-janitors] [PATCH] drivers/video/pm2fb.c MIN/MAX removal Michael Veeck
2004-02-18 22:13 ` [Kernel-janitors] [PATCH] drivers/video/neofb.patch update Leann Ogasawara

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.