lkml.org 
[lkml]   [2014]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] gpio / ACPI: Prevent potential wrap of GPIO value on OpRegion read
From
On Tue, Apr 1, 2014 at 12:03 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:

> Dan Carpenter's static code checker reports:
>
> The patch 473ed7be0da0: "gpio / ACPI: Add support for ACPI GPIO
> operation regions" from Mar 14, 2014, leads to the following static
> checker warning:
>
> drivers/gpio/gpiolib-acpi.c:454 acpi_gpio_adr_space_handler()
> warn: should 'gpiod_get_raw_value(desc) << i' be a 64 bit type?
>
> This is due the fact that *value is of type u64 and gpiod_get_raw_value()
> returns int. Since i can be larger than 31, it is possible that the value
> returned gets wrapped.
>
> Fix this by casting the return of gpiod_get_raw_value() to u64 first before
> shift.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Patch applied for fixes.

Yours,
Linus Walleij


\
 
 \ /
  Last update: 2014-04-10 18:41    [W:0.070 / U:12.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site