Thread (6 messages) 6 messages, 3 authors, 2013-01-08

Re: [PATCH] backlight: check null deference of name when device is registered

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2013-01-08 00:01:41
Also in: lkml

On Fri, 04 Jan 2013 17:29:11 +0900
Jingoo Han [off-list ref] wrote:
quoted hunk ↗ jump to hunk
NULL deference of name is checked when device is registered.
If the name is null, it will cause a kernel oops in dev_set_name().

...
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -292,6 +292,11 @@ struct backlight_device *backlight_device_register(const char *name,
 	struct backlight_device *new_bd;
 	int rc;
 
+	if (name = NULL) {
+		pr_err("backlight name is null\n");
+		return ERR_PTR(-EINVAL);
+	}
+
 	pr_debug("backlight_device_register: name=%s\n", name);
I don't understand this.

Is there some driver which is calling these functions with name=NULL? 
If so, which one(s)?

If "no" then why don't we declare that "passing name=NULL is a bug" and
leave the code as-is?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help