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: <CANiDSCt0PXTP63=dkNpUvH6mYSJ2_mr5xiOd9=RpLqVoD4YY_g@mail.gmail.com>
Date: Thu, 30 May 2024 14:59:47 +0200
From: Ricardo Ribalda <ribalda@...omium.org>
To: Hans Verkuil <hverkuil-cisco@...all.nl>
Cc: Michael Tretter <m.tretter@...gutronix.de>, 
	Pengutronix Kernel Team <kernel@...gutronix.de>, Mauro Carvalho Chehab <mchehab@...nel.org>, 
	Laurent Pinchart <laurent.pinchart@...asonboard.com>, Michal Simek <michal.simek@....com>, 
	Andy Walls <awalls@...metrocast.net>, Stanimir Varbanov <stanimir.k.varbanov@...il.com>, 
	Vikash Garodia <quic_vgarodia@...cinc.com>, "Bryan O'Donoghue" <bryan.odonoghue@...aro.org>, 
	Bjorn Andersson <andersson@...nel.org>, Konrad Dybcio <konrad.dybcio@...aro.org>, 
	linux-media@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH v3 03/18] media: dvb-frontend/mxl5xx: Refactor struct MBIN_FILE_T

Hi Hans

On Thu, 30 May 2024 at 14:33, Hans Verkuil <hverkuil-cisco@...all.nl> wrote:
>
> On 27/05/2024 23:08, Ricardo Ribalda wrote:
> > Replace a single element array, with a single element field.
> >
> > The following cocci warning is fixed:
> > drivers/media/dvb-frontends/mxl5xx_defs.h:171:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
> >
> > Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
> > ---
> >  drivers/media/dvb-frontends/mxl5xx.c      | 2 +-
> >  drivers/media/dvb-frontends/mxl5xx_defs.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/dvb-frontends/mxl5xx.c b/drivers/media/dvb-frontends/mxl5xx.c
> > index 91e9c378397c..a15c0438b07a 100644
> > --- a/drivers/media/dvb-frontends/mxl5xx.c
> > +++ b/drivers/media/dvb-frontends/mxl5xx.c
> > @@ -893,7 +893,7 @@ static int do_firmware_download(struct mxl *state, u8 *mbin_buffer_ptr,
> >       status = write_register(state, FW_DL_SIGN_ADDR, 0);
> >       if (status)
> >               return status;
> > -     segment_ptr = (struct MBIN_SEGMENT_T *) (&mbin_ptr->data[0]);
> > +     segment_ptr = (struct MBIN_SEGMENT_T *)(&mbin_ptr->data);
> >       for (index = 0; index < mbin_ptr->header.num_segments; index++) {
> >               if (segment_ptr->header.id != MBIN_SEGMENT_HEADER_ID) {
> >                       dev_err(state->i2cdev, "%s: Invalid segment header ID (%c)\n",
> > diff --git a/drivers/media/dvb-frontends/mxl5xx_defs.h b/drivers/media/dvb-frontends/mxl5xx_defs.h
> > index 097271f73740..3c5d75ed8fea 100644
> > --- a/drivers/media/dvb-frontends/mxl5xx_defs.h
> > +++ b/drivers/media/dvb-frontends/mxl5xx_defs.h
> > @@ -168,7 +168,7 @@ struct MBIN_FILE_HEADER_T {
> >
> >  struct MBIN_FILE_T {
> >       struct MBIN_FILE_HEADER_T header;
> > -     u8 data[1];
> > +     u8 data;
>
> From what I can tell, shouldn't this be 'data[]'? It really appears to be a flexible array.

The field is mainly used to ease the data parsing. There was only
data[0] used, so I decided to make it into a single element array to
avoid changing the size of the structure....

But you are correct, it looks more clear as a flex array and there is
no allocation or sizeof() so I think it is safe to change its size.

Will squash with the MBIN_SEGMENT_T patch also

Thanks!


>
> Regards,
>
>         Hans
>
> >  };
> >
> >  struct MBIN_SEGMENT_HEADER_T {
> >
>


-- 
Ricardo Ribalda

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ