Skip to contentSkip to conversation

video:uvesafb: Fix dereference NULL pointer code path

PATCH In review Wang YanQing 2 participants 2 messages Mar 30, 2013 – Apr 2, 2013 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video:uvesafb: Fix dereference NULL pointer code path

platform_device_alloc could failed and return NULL, we should check this before call platform_device_put.

---
 drivers/video/uvesafb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/uvesafb.c +2 -1
index 2f8f82d..230bd45 100644
@@ -1975,7 +1975,8 @@ static int __devinit uvesafb_init(void)
 			err = -ENOMEM;
 
 		if (err) {
-			platform_device_put(uvesafb_device);
+			if (uvesafb_device)
+				platform_device_put(uvesafb_device);
 			platform_driver_unregister(&uvesafb_driver);
 			cn_del_callback(&uvesafb_cn_id);
 			return err;
Signature · 1 line
1.7.11.1.116.g8228a23
#1 lore raw
Quoted 14 lines · Wang YanQing

platform_device_alloc could failed and return NULL, we should check this before call platform_device_put.

---
 drivers/video/uvesafb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/uvesafb.c +0 -0
index 2f8f82d..230bd45 100644

drivers/video/uvesafb.c static int __devinit uvesafb_init(void) · line 1982

Quoted 9 lines
drivers/video/uvesafb.c +2 -1
@@ -1975,7 +1975,8 @@ static int __devinit uvesafb_init(void)
 			err = -ENOMEM;
 
 		if (err) {
-			platform_device_put(uvesafb_device);
+			if (uvesafb_device)
+				platform_device_put(uvesafb_device);
 			platform_driver_unregister(&uvesafb_driver);
 			cn_del_callback(&uvesafb_cn_id);
 			return err;

Thanks, queued to fbdev fixes.

Tomi