From: "devendra.aaru" <devendra.aaru@gmail.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: backlight_register_device can oops if name is null ?
Date: Thu, 03 Jan 2013 05:22:41 +0000 [thread overview]
Message-ID: <CAHdPZaMubzyBXWb83qB9_CuFFqQprB4d+2XhzOoQeoN6fruRMg@mail.gmail.com> (raw)
In-Reply-To: <CAHdPZaMKfMA=Z6n-X+3NMR-CScfwQmKYuyoJHBeK2bYFn8EEdg@mail.gmail.com>
>>>
>> so if i understand the code pr_debug code, i see a printk macro assignment,
>>
>> is it something like printk or a wrapper macro around printk are
>> making sure that the strings are non null ?
>
> Sorry, I don't know how printk deals this null.
>
> But I tested null by using ams369fg06 driver as below:
>
> - bd = backlight_device_register("ams369fg06-bl", &spi->dev, lcd,
> + bd = backlight_device_register(NULL, &spi->dev, lcd,
>
> Also, I replaced pr_debug with printk as below:
>
> - pr_debug("backlight_device_register: name=%s\n", name);
> + printk("backlight_device_register: name=%s\n", name);
>
> In this case, printk message is as below:
>
> backlight_device_register: name=(null)
>
>>
wow, you tested the code, i would have done it with a single module,
great and thanks for lot of information you are putting .
>> the documentation of the backlight_device_register says that "name
>> must be same as the name of the respected frame buffer device", but do
>> we really add a check for the null to do dev_set_name? or fail the
>> registering ?
>
> "name must be same as the name of the respected frame buffer device" is
> not correct. Most backlight drivers are using their driver name as 'name'.
>
> Anyway, in my opinion, deference to null does not seem to happen.
> Now, backlight_device_register() calls are using 'name' properly.
>
>
> However, if a check for the null is added, it will be added to
> backlight_device_register() as below:
>
>
> @@ -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(".....");
> + return -EINVAL
> + }
> +
This is what exactly i was thinking, thanks for making a patch too.
If you want to submit it then please take my
Acked-By: Devendra Naga <devendra.aaru@gmail.com>
prev parent reply other threads:[~2013-01-03 5:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-31 21:04 backlight_register_device can oops if name is null ? devendra.aaru
2013-01-02 0:44 ` Jingoo Han
2013-01-02 16:40 ` devendra.aaru
2013-01-03 2:31 ` Jingoo Han
2013-01-03 5:22 ` devendra.aaru [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHdPZaMubzyBXWb83qB9_CuFFqQprB4d+2XhzOoQeoN6fruRMg@mail.gmail.com \
--to=devendra.aaru@gmail.com \
--cc=linux-fbdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).