[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdY6mUsydabXJDNZC2Wyu0Hx0Ut8xhqpYO5Rcr+FBHwMJg@mail.gmail.com>
Date: Tue, 7 Jan 2020 11:03:57 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Kent Gibson <warthog618@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH v4 03/13] gpiolib: convert the type of hwnum to unsigned
int in gpiochip_get_desc()
On Tue, Dec 24, 2019 at 1:07 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> From: Bartosz Golaszewski <bgolaszewski@...libre.com>
>
> gpiochip_get_desc() takes a u16 hwnum, but it turns out most users don't
> respect that and usually pass an unsigned int. Since implicit casting to
> a smaller type is dangerous - let's change the type of hwnum to unsigned
> int in gpiochip_get_desc() and in gpiochip_request_own_desc() where the
> size of hwnum is not respected either and who's a user of the former.
>
> This is safe as we then check the hwnum against the number of lines
> before proceeding in gpiochip_get_desc().
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
Powered by blists - more mailing lists