[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200812052941.GA116346@sol>
Date: Wed, 12 Aug 2020 13:29:41 +0800
From: Kent Gibson <warthog618@...il.com>
To: linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
bgolaszewski@...libre.com, linus.walleij@...aro.org
Subject: Re: [PATCH v3 06/18] gpiolib: cdev: support
GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL
On Sun, Aug 09, 2020 at 09:25:17PM +0800, Kent Gibson wrote:
> Add support for GPIO_V2_GET_LINEINFO_IOCTL and
> GPIO_V2_GET_LINEINFO_WATCH_IOCTL.
>
> Signed-off-by: Kent Gibson <warthog618@...il.com>
> ---
>
[snip]
>
> if (copy_from_user(&lineinfo, ip, sizeof(lineinfo)))
> return -EFAULT;
> @@ -1251,7 +1353,9 @@ static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> if (IS_ERR(desc))
> return PTR_ERR(desc);
>
> - gpio_desc_to_lineinfo(desc, &lineinfo);
> + gpio_desc_to_lineinfo(desc, &lineinfo_v2);
> + lineinfo_v2.offset = lineinfo.line_offset;
> + gpio_v2_line_info_to_v1(&lineinfo_v2, &lineinfo);
>
This is broken as gpio_desc_to_lineinfo() requires the offset to be
already set in the info. I could move the setting of offset before the
call, but would rather change gpio_desc_to_lineinfo() to treat info
strictly as output (it can determine the offset from the desc) so as
not to trap anyone else in the future.
I also intend to replace the use of strncpy, from this patch and
elsewhere, to placate the build-bot.
Cheers,
Kent.
Powered by blists - more mailing lists