Re: [PATCHv2 7/8] videobuf2: handle V4L2_MEMORY_FLAG_NON_COHERENT flag

From: Sergey Senozhatsky
Date: Wed Jun 16 2021 - 21:46:45 EST


On (21/06/03 13:32), Hans Verkuil wrote:
[..]
> > +static void validate_memory_flags(struct vb2_queue *q,
> > + int memory,
> > + u32 *flags)
> > +{
> > + if (!q->allow_cache_hints || memory != V4L2_MEMORY_MMAP) {
> > + /*
> > + * This needs to clear V4L2_MEMORY_FLAG_NON_COHERENT only,
> > + * but in order to avoid bugs we zero out all bits.
> > + */
> > + *flags = 0;
>
> Wouldn't it make sense to add:
>
> } else {
> *flags &= ~V4L2_MEMORY_FLAG_NON_COHERENT;
>
> I.e., clear all unknown flags.

Done.

[..]
> > @@ -2003,9 +2003,6 @@ static int v4l_reqbufs(const struct v4l2_ioctl_ops *ops,
> >
> > if (ret)
> > return ret;
> > -
> > - CLEAR_AFTER_FIELD(p, capabilities);
>
> Shouldn't this be:
>
> CLEAR_AFTER_FIELD(p, flags);
>
> You still need to zero the reserved array, after all.

Done.