lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACaw+exXoVxeJz+3JdaW8peTo-zuYLez1Vw3+R4fpatjWVY7NA@mail.gmail.com>
Date: Mon, 30 Jun 2025 16:36:12 -0300
From: Desnes Nunes <desnesn@...hat.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: Ricardo Ribalda <ribalda@...omium.org>, hansg@...nel.org, linux-media@...r.kernel.org, 
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] media: uvcvideo: fix build error in uvc_ctrl_cleanup_fh

Hello Laurent,

Yes, I did see that commit and will send a v2 to properly address the
variable shadowing following C11 standards.

Thanks for the review Laurent,

On Mon, Jun 30, 2025 at 12:30 PM Laurent Pinchart
<laurent.pinchart@...asonboard.com> wrote:
>
> On Mon, Jun 30, 2025 at 05:15:38PM +0200, Ricardo Ribalda wrote:
> > Hi Desdes
> >
> > How did you trigger this build warning? I believe we use C11
> >
> > https://www.kernel.org/doc/html/latest/process/programming-language.html
>
> Note that the local declaration of the loop counter shadows the global
> one. I would have expected a different compiler warning though.
>
> The shadowing was introduced by
>
> commit 10acb9101355484c3e4f2625003cd1b6c203cfe4
> Author: Ricardo Ribalda <ribalda@...omium.org>
> Date:   Thu Mar 27 21:05:29 2025 +0000
>
>     media: uvcvideo: Increase/decrease the PM counter per IOCTL
>
> and I think it should be fixed (while at it, with an unsigned int local
> loop counter instead of a signed int) as it's not a good practice.
>
> > On Mon, 30 Jun 2025 at 17:07, Desnes Nunes <desnesn@...hat.com> wrote:
> > >
> > > This fixes the following compilation failure: "error: ‘for’ loop
> > > initial declarations are only allowed in C99 or C11 mode"
> > >
> > > Cc: stable@...r.kernel.org
> > > Fixes: 221cd51efe45 ("media: uvcvideo: Remove dangling pointers")
> > > Signed-off-by: Desnes Nunes <desnesn@...hat.com>
> > > ---
> > >  drivers/media/usb/uvc/uvc_ctrl.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> > > index 44b6513c5264..532615d8484b 100644
> > > --- a/drivers/media/usb/uvc/uvc_ctrl.c
> > > +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> > > @@ -3260,7 +3260,7 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
> > >  void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
> > >  {
> > >         struct uvc_entity *entity;
> > > -       int i;
> > > +       unsigned int i;
> > >
> > >         guard(mutex)(&handle->chain->ctrl_mutex);
> > >
> > > @@ -3268,7 +3268,7 @@ void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
> > >                 return;
> > >
> > >         list_for_each_entry(entity, &handle->chain->dev->entities, list) {
> > > -               for (unsigned int i = 0; i < entity->ncontrols; ++i) {
> > > +               for (i = 0; i < entity->ncontrols; ++i) {
> > >                         if (entity->controls[i].handle != handle)
> > >                                 continue;
> > >                         uvc_ctrl_set_handle(handle, &entity->controls[i], NULL);
>
> --
> Regards,
>
> Laurent Pinchart
>


-- 
Desnes Nunes


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ