Re: 2.6.8-rc2-mm1

Andrew Morton
2004-07-29T06:45:17Z

Johannes Stezenbach <js@convergence.de> wrote:
>
> Andrew Morton wrote:
> > Johannes Stezenbach <js@convergence.de> wrote:
> > >
> > > This is a hack introduced by someone years ago. The "pointer" is
> > > actually an integer argument, e.g. in include/linux/dvb/audio.h:
> > >
> > > #define AUDIO_SET_MUTE _IO('o', 6)
> > >
> > > actually takes an integer argument (!0 mute, 0 unmute), so one can write
> > >
> > > if (ioctl(fd, AUDIO_SET_MUTE, 1) == -1)
> > > perror("mute");
> >
> > Is it a boolean argument?
> >
> > If so, we could change the code to do
> >
> > parg = (void *)(arg ? 1 : 0);
> >
> > so if someone dereferences it they'll get a nice oops.
>
> Unfortunately there are a few more ioctls which use enums,
> e.g. AUDIO_CHANNEL_SELECT has an argument of type
> audio_channel_select_t etc. (yes, I know, those typedefs
> should go). Or even DMX_SET_BUFFER_SIZE...

OK. Well how's about we add a fifth argument to that callback function, of
type `int'? Stick this integer in there and leave the fourth argument NULL
for this class of ioctl?