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@xxxxxxxxx> > --- > [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.