Message ID | 20200611023414.4702-1-paul.elder@ideasonboard.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | v4l2-ctl: Fix test_ioctl cmd type | expand |
ping On Thu, Jun 11, 2020 at 11:34:14AM +0900, Paul Elder wrote: > test_ioctl uses int for the ioctl cmd, while it should be unsigned long. > Fix this. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > --- > utils/v4l2-ctl/v4l2-ctl.cpp | 2 +- > utils/v4l2-ctl/v4l2-ctl.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp > index e7b270cd..4972591e 100644 > --- a/utils/v4l2-ctl/v4l2-ctl.cpp > +++ b/utils/v4l2-ctl/v4l2-ctl.cpp > @@ -306,7 +306,7 @@ static void usage_all() > edid_usage(); > } > > -int test_ioctl(int fd, int cmd, void *arg) > +int test_ioctl(int fd, unsigned long cmd, void *arg) > { > return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg); > } > diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h > index b31be7f5..28e50471 100644 > --- a/utils/v4l2-ctl/v4l2-ctl.h > +++ b/utils/v4l2-ctl/v4l2-ctl.h > @@ -300,7 +300,7 @@ typedef struct { > > // v4l2-ctl.cpp > int doioctl_name(int fd, unsigned long int request, void *parm, const char *name); > -int test_ioctl(int fd, int cmd, void *arg); > +int test_ioctl(int fd, unsigned long cmd, void *arg); > int parse_subopt(char **subs, const char * const *subopts, char **value); > __u32 parse_field(const char *s); > __u32 parse_colorspace(const char *s); > -- > 2.25.1 >
Hi Paul, Thank you for the patch. On Fri, Jun 19, 2020 at 05:27:58PM +0900, Paul Elder wrote: > ping > > On Thu, Jun 11, 2020 at 11:34:14AM +0900, Paul Elder wrote: > > test_ioctl uses int for the ioctl cmd, while it should be unsigned long. > > Fix this. This matches the libc ioctl() prototype and the ioctl values (the _IOC macro produces, if I'm not mistaken, an unsigned type) and should help avoiding sign extension issues. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > > utils/v4l2-ctl/v4l2-ctl.cpp | 2 +- > > utils/v4l2-ctl/v4l2-ctl.h | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp > > index e7b270cd..4972591e 100644 > > --- a/utils/v4l2-ctl/v4l2-ctl.cpp > > +++ b/utils/v4l2-ctl/v4l2-ctl.cpp > > @@ -306,7 +306,7 @@ static void usage_all() > > edid_usage(); > > } > > > > -int test_ioctl(int fd, int cmd, void *arg) > > +int test_ioctl(int fd, unsigned long cmd, void *arg) > > { > > return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg); > > } > > diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h > > index b31be7f5..28e50471 100644 > > --- a/utils/v4l2-ctl/v4l2-ctl.h > > +++ b/utils/v4l2-ctl/v4l2-ctl.h > > @@ -300,7 +300,7 @@ typedef struct { > > > > // v4l2-ctl.cpp > > int doioctl_name(int fd, unsigned long int request, void *parm, const char *name); > > -int test_ioctl(int fd, int cmd, void *arg); > > +int test_ioctl(int fd, unsigned long cmd, void *arg); > > int parse_subopt(char **subs, const char * const *subopts, char **value); > > __u32 parse_field(const char *s); > > __u32 parse_colorspace(const char *s);
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index e7b270cd..4972591e 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -306,7 +306,7 @@ static void usage_all() edid_usage(); } -int test_ioctl(int fd, int cmd, void *arg) +int test_ioctl(int fd, unsigned long cmd, void *arg) { return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg); } diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h index b31be7f5..28e50471 100644 --- a/utils/v4l2-ctl/v4l2-ctl.h +++ b/utils/v4l2-ctl/v4l2-ctl.h @@ -300,7 +300,7 @@ typedef struct { // v4l2-ctl.cpp int doioctl_name(int fd, unsigned long int request, void *parm, const char *name); -int test_ioctl(int fd, int cmd, void *arg); +int test_ioctl(int fd, unsigned long cmd, void *arg); int parse_subopt(char **subs, const char * const *subopts, char **value); __u32 parse_field(const char *s); __u32 parse_colorspace(const char *s);
test_ioctl uses int for the ioctl cmd, while it should be unsigned long. Fix this. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- utils/v4l2-ctl/v4l2-ctl.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)