* [PATCH] sony-laptop - fix using of uninitialized variable
@ 2010-01-10 8:15 Dmitry Torokhov
2010-01-10 10:52 ` Mattia Dongili
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2010-01-10 8:15 UTC (permalink / raw)
To: Mattia Dongili; +Cc: Len Brown, linux-acpi
CC [M] drivers/platform/x86/sony-laptop.o
drivers/platform/x86/sony-laptop.c: In function 'sony_nc_rfkill_setup':
drivers/platform/x86/sony-laptop.c:1162: warning: 'i' may be used uninitialized in this function
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
This is a real warning and without the fix we may be setting up
non-existing rfkill devices so please consider for .33.
drivers/platform/x86/sony-laptop.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 5af5334..3f71a60 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1201,9 +1201,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
/* the buffer is filled with magic numbers describing the devices
* available, 0xff terminates the enumeration
*/
- while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff &&
- i < device_enum->buffer.length) {
- i++;
+ for (i = 0; i < device_enum->buffer.length; i++) {
+
+ dev_code = *(device_enum->buffer.pointer + i);
+ if (dev_code == 0xff)
+ break;
+
dprintk("Radio devices, looking at 0x%.2x\n", dev_code);
if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI])
--
Dmitry
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sony-laptop - fix using of uninitialized variable
2010-01-10 8:15 [PATCH] sony-laptop - fix using of uninitialized variable Dmitry Torokhov
@ 2010-01-10 10:52 ` Mattia Dongili
2010-01-16 20:55 ` Len Brown
0 siblings, 1 reply; 3+ messages in thread
From: Mattia Dongili @ 2010-01-10 10:52 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Len Brown, linux-acpi
On Sun, Jan 10, 2010 at 12:15:44AM -0800, Dmitry Torokhov wrote:
> CC [M] drivers/platform/x86/sony-laptop.o
> drivers/platform/x86/sony-laptop.c: In function 'sony_nc_rfkill_setup':
> drivers/platform/x86/sony-laptop.c:1162: warning: 'i' may be used uninitialized in this function
>
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> ---
>
> This is a real warning and without the fix we may be setting up
> non-existing rfkill devices so please consider for .33.
Thanks Dmitry.
Len, please submit this for 2.6.33 and add my
Acked-by: Mattia Dongili <malattia@linux.it>
--
mattia
:wq!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sony-laptop - fix using of uninitialized variable
2010-01-10 10:52 ` Mattia Dongili
@ 2010-01-16 20:55 ` Len Brown
0 siblings, 0 replies; 3+ messages in thread
From: Len Brown @ 2010-01-16 20:55 UTC (permalink / raw)
To: Mattia Dongili; +Cc: Dmitry Torokhov, linux-acpi
applied
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-16 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-10 8:15 [PATCH] sony-laptop - fix using of uninitialized variable Dmitry Torokhov
2010-01-10 10:52 ` Mattia Dongili
2010-01-16 20:55 ` Len Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox