From: Andrew Morton <akpm@linux-foundation.org>
To: Jingoo Han <jg1.han@samsung.com>
Cc: 'LKML' <linux-kernel@vger.kernel.org>,
linux-fbdev@vger.kernel.org, 'Richard Purdie' <rpurdie@rpsys.net>,
'Devendra Naga' <devendra.aaru@gmail.com>
Subject: Re: [PATCH] backlight: check null deference of name when device is registered
Date: Tue, 08 Jan 2013 01:35:57 +0000 [thread overview]
Message-ID: <20130107173557.dadc0a7a.akpm@linux-foundation.org> (raw)
In-Reply-To: <003c01cded3f$0f25a3e0$2d70eba0$%han@samsung.com>
On Tue, 08 Jan 2013 10:25:35 +0900 Jingoo Han <jg1.han@samsung.com> wrote:
> On Tuesday, January 08, 2013 9:02 AM, Andrew Morton wrote
> > On Fri, 04 Jan 2013 17:29:11 +0900
> > Jingoo Han <jg1.han@samsung.com> wrote:
> >
> > > 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)?
>
> 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);
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.
next prev parent reply other threads:[~2013-01-08 1:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 8:29 [PATCH] backlight: check null deference of name when device is registered Jingoo Han
2013-01-08 0:01 ` Andrew Morton
2013-01-08 1:25 ` Jingoo Han
2013-01-08 1:35 ` Andrew Morton [this message]
2013-01-08 1:39 ` Jingoo Han
2013-01-08 4:28 ` devendra.aaru
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=20130107173557.dadc0a7a.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=devendra.aaru@gmail.com \
--cc=jg1.han@samsung.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/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).