[PATCH] ioctl.c: fix the misuse of _IOC_NR

Zhibin Li haoyouab at gmail.com
Tue Jul 2 04:52:29 UTC 2019


On Tue, Jul 2, 2019 at 5:53 AM Dmitry V. Levin <ldv at altlinux.org> wrote:

> On Sun, Jun 30, 2019 at 02:03:10PM +0800, Zhibin Li wrote:
> > * ioctl.c: We should use _IOC_NR(code) instead of _IOC_NR(nr).
> > ---
> > This looks like a misuse of _IOC_NR. Though it doesn't change the output
> > at all because the value of _IOC_NR(nr) is the same as _IOC_NR(code). I
> > guess this is not intended but a typo?
> >  ioctl.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/ioctl.c b/ioctl.c
> > index d3205b22..c2146e07 100644
> > --- a/ioctl.c
> > +++ b/ioctl.c
> > @@ -91,7 +91,7 @@ evdev_decode_number(const unsigned int code)
> >               return 1;
> >       }
> >
> > -     switch (_IOC_NR(nr)) {
> > +     switch (_IOC_NR(code)) {
>
> I agree with your analysis, but I think the fix should rather be
>
> -       switch (_IOC_NR(nr)) {
> +       switch (nr) {
>
> Yes of course.

>
> --
> ldv
> --
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190702/46831057/attachment.html>


More information about the Strace-devel mailing list