From: Jingoo Han <hidden> Date: 2013-01-04 08:29:17
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().
Acked-by: Devendra Naga <redacted>
Signed-off-by: Jingoo Han <redacted>
---
drivers/video/backlight/backlight.c | 5 +++++
drivers/video/backlight/lcd.c | 5 +++++
2 files changed, 10 insertions(+), 0 deletions(-)
@@ -292,6 +292,11 @@ struct backlight_device *backlight_device_register(const char *name,structbacklight_device*new_bd;intrc;+if(name=NULL){+pr_err("backlight name is null\n");+returnERR_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?
@@ -292,6 +292,11 @@ struct backlight_device *backlight_device_register(const char *name,structbacklight_device*new_bd;intrc;+if(name=NULL){+pr_err("backlight name is null\n");+returnERR_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)?
No, there is no one.
If "no" then why don't we declare that "passing name=NULL is a bug" and
leave the code as-is?
Do you mean following?
+ if (name = NULL)
+ pr_err("passing name=NULL is a bug");
+
pr_debug("backlight_device_register: name=%s\n", name);
Best regards,
Jingoo Han
@@ -292,6 +292,11 @@ struct backlight_device *backlight_device_register(const char *name,structbacklight_device*new_bd;intrc;+if(name=NULL){+pr_err("backlight name is null\n");+returnERR_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)?
No, there is no one.
quoted
If "no" then why don't we declare that "passing name=NULL is a bug" and
leave the code as-is?
Do you mean following?
+ if (name = NULL)
+ pr_err("passing name=NULL is a bug");
+
pr_debug("backlight_device_register: name=%s\n", name);
Nope; I'm suggesting we leave the code alone. If someone passes in
NULL they will get a nice oops and their bug will then get fixed.
I see. I agree with you.
Please, abandon this patch.
Best regards,
Jingoo Han
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -292,6 +292,11 @@ struct backlight_device *backlight_device_register(const char *name,structbacklight_device*new_bd;intrc;+if(name=NULL){+pr_err("backlight name is null\n");+returnERR_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)?
No, there is no one.
quoted
If "no" then why don't we declare that "passing name=NULL is a bug" and
leave the code as-is?
Do you mean following?
+ if (name = NULL)
+ pr_err("passing name=NULL is a bug");
+
pr_debug("backlight_device_register: name=%s\n", name);
Nope; I'm suggesting we leave the code alone. If someone passes in
NULL they will get a nice oops and their bug will then get fixed.
We still fail the probe in the patch Jingoo Han sent,
anyways if i catch your point correctly is this the lines you wanted?
+ /**
+ * BUG if the name of the backlight device
+ * is a NULL
+ */
+ BUG_ON(!name);