linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] HID: picoLCD: fix a NULL test in picolcd_raw_cir()
@ 2012-09-07  6:47 Dan Carpenter
  2012-09-07 21:38 ` Bruno Prémont
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-09-07  6:47 UTC (permalink / raw)
  To: Bruno Prémont; +Cc: Jiri Kosina, linux-input, kernel-janitors

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.

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;
 	}

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-08 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-09-08 19:20   ` Jiri Kosina

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).