From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Dan Carpenter <dan.carpenter@oracle.com>, Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] HID: picoLCD: fix a NULL test in picolcd_raw_cir()
Date: Fri, 7 Sep 2012 23:38:18 +0200 [thread overview]
Message-ID: <20120907233818.62aa63d2@neptune.home> (raw)
In-Reply-To: <20120907064740.GB12028@elgon.mountain>
On Fri, 07 September 2012 Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Smatch complains that the NULL checking in this function is not
> consistent and could lead to a NULL dereference. The comments say that
> we should return here if rc_dev is NULL so I've changed the test to
> match the comment.
Good catch! Currently thanks to HID mutex around probe()/remove()
we should never be able to see rc_dev being NULL here.
Once the probe()/remove() mutex gets tied to hw_start()/hw_stop() or
otherwise changed to allow drivers to chat with device during probe()
->rc_dev might be NULL in picolcd_raw_cir().
Reviewed-by: Bruno Prémont <bonbons@linux-vserver.org>
Jiri, please apply to picolcd branch.
Thanks,
Bruno
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Only needed in linux-next. This is a static checker fix and I don't
> have the hardware to test it. Please review carefully.
>
> diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c
> index 14c5ce0..13ca919 100644
> --- a/drivers/hid/hid-picolcd_cir.c
> +++ b/drivers/hid/hid-picolcd_cir.c
> @@ -51,7 +51,7 @@ int picolcd_raw_cir(struct picolcd_data *data,
>
> /* ignore if rc_dev is NULL or status is shunned */
> spin_lock_irqsave(&data->lock, flags);
> - if (data->rc_dev && (data->status & PICOLCD_CIR_SHUN)) {
> + if (!data->rc_dev || (data->status & PICOLCD_CIR_SHUN)) {
> spin_unlock_irqrestore(&data->lock, flags);
> return 1;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-09-07 21:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 6:47 [patch] HID: picoLCD: fix a NULL test in picolcd_raw_cir() Dan Carpenter
2012-09-07 21:38 ` Bruno Prémont [this message]
2012-09-08 19:20 ` Jiri Kosina
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=20120907233818.62aa63d2@neptune.home \
--to=bonbons@linux-vserver.org \
--cc=dan.carpenter@oracle.com \
--cc=jkosina@suse.cz \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@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).