lkml.org 
[lkml]   [2020]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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@gmail.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.

    \
     
     \ /
      Last update: 2020-08-12 07:30    [W:6.533 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site