On Tue, 3 Mar 2009, Mauro Carvalho Chehab wrote:
> On Tue, 3 Mar 2009 13:59:27 -0800 (PST)
> Trent Piepho <xy...@speakeasy.org> wrote:
>
> > 04/04: v4l2: Move code to zero querybuf output struct to v4l2_ioctl
> > http://linuxtv.org/hg/~tap/v4l-dvb?cmd=changeset;node=d31e6e7a8241
>
> Hmm.. The idea of using this memset seemed interesting:
>
> f02233e4 (Trent Piepho          2009-03-03 20:44:45 -0300  974)               
>   memset(0, &p->bytesused,
> f02233e4 (Trent Piepho          2009-03-03 20:44:45 -0300  975)               
>          sizeof(*p) - offsetof(typeof(*p), bytesused));
>
> But the end result is that, when compiling it on my -git tree, to have those 
> errors with i386:
>
> drivers/media/video/v4l2-ioctl.c: In function ???__video_do_ioctl???:
> drivers/media/video/v4l2-ioctl.c:974: warning: cast from pointer to integer 
> of different size
> drivers/media/video/v4l2-ioctl.c:974: warning: cast from pointer to integer 
> of different size
> drivers/media/video/v4l2-ioctl.c:974: warning: passing argument 2 of 
> ???__memset_generic??? makes integer from pointer without a cast
> drivers/media/video/v4l2-ioctl.c:974: warning: passing argument 2 of 
> ???__memset_generic??? makes integer from pointer without a cast
>
> Could you please provide us a fix?

Opps, the memset arguments are in the wrong order.  It should be instead:

memset(&p->bytesused, 0, sizeof(*p) - offsetof(typeof(*p), bytesused));

I wonder why I didn't get that warning?

I've extended this idea in a more generic fashion to all the ioctls that
are like querybuf, which replaced this code with some that's correct.  I'll
send a pull request shortly.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to