From: Adrian Bunk <bunk@stusta.de>
To: greg@kroah.com
Cc: linux-usb-devel@lists.sourceforge.ne, linux-kernel@vger.kernel.org
Subject: [2.6 patch] usb/input/keyspan_remote.c: don't use an uninitialized variable
Date: Sat, 25 Mar 2006 18:12:14 +0100 [thread overview]
Message-ID: <20060325171214.GG4053@stusta.de> (raw)
gcc reported the following:
<-- snip -->
...
CC drivers/usb/input/keyspan_remote.o
drivers/usb/input/keyspan_remote.c: In function 'keyspan_irq_recv':
drivers/usb/input/keyspan_remote.c:186: warning: 'message.toggle' may be used uninitialized in this function
...
<-- snip -->
gcc is right, there is an error case where this actually happens.
What about this patch that returns in this error case?
Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
--- linux-2.6.16-mm1-full/drivers/usb/input/keyspan_remote.c.old 2006-03-25 15:44:56.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/usb/input/keyspan_remote.c 2006-03-25 15:45:48.000000000 +0100
@@ -285,30 +285,31 @@ static void keyspan_check_data(struct us
return;
}
}
keyspan_load_tester(remote, 6);
if ((remote->data.tester & ZERO_MASK) == ZERO) {
message.toggle = 0;
remote->data.tester = remote->data.tester >> 5;
remote->data.bits_left -= 5;
} else if ((remote->data.tester & ONE_MASK) == ONE) {
message.toggle = 1;
remote->data.tester = remote->data.tester >> 6;
remote->data.bits_left -= 6;
} else {
err("%s - Error in message, invalid toggle.\n", __FUNCTION__);
+ return;
}
keyspan_load_tester(remote, 5);
if ((remote->data.tester & STOP_MASK) == STOP) {
remote->data.tester = remote->data.tester >> 5;
remote->data.bits_left -= 5;
} else {
err("Bad message recieved, no stop bit found.\n");
}
dev_dbg(&remote->udev->dev,
"%s found valid message: system: %d, button: %d, toggle: %d\n",
__FUNCTION__, message.system, message.button, message.toggle);
if (message.toggle != remote->toggle) {
next reply other threads:[~2006-03-25 17:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-25 17:12 Adrian Bunk [this message]
2006-03-25 17:37 ` [2.6 patch] usb/input/keyspan_remote.c: don't use an uninitialized variable Adrian Bunk
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=20060325171214.GG4053@stusta.de \
--to=bunk@stusta.de \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.ne \
/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