All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak R Varma <drv@mailo.com>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: outreachy@lists.linux.dev,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8188eu: Use flexible-array for one length array member
Date: Fri, 28 Oct 2022 19:41:54 +0530	[thread overview]
Message-ID: <Y1vjKtM9druO2bSN@ubunlion> (raw)
In-Reply-To: <642519a2-664d-d837-983a-1d5bbc72a25e@gmail.com>

On Fri, Oct 28, 2022 at 05:03:25PM +0300, Pavel Skripkin wrote:
> Hi Deepak R,
>
> Deepak R Varma <drv@mailo.com> says:
> > Flexible-array member should be used instead of one or zero member to
> > meet the need for having a dynamically sized trailing elements in a
> > structure. Refer to links [1] and [2] for detailed guidance on this
> > suggestion.
> >
> > [1] https://en.wikipedia.org/wiki/Flexible_array_member
> > [2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
> >
> > Issue identified using coccicheck.
> >
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
> > ---
> >   drivers/staging/r8188eu/include/odm.h         | 2 +-
> >   drivers/staging/r8188eu/include/wlan_bssdef.h | 6 +++---
> >   2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
> > index 89b01dd614ba..e2a9de5b9323 100644
> > --- a/drivers/staging/r8188eu/include/odm.h
> > +++ b/drivers/staging/r8188eu/include/odm.h
> > @@ -166,7 +166,7 @@ struct odm_ra_info {
> >
> >   struct ijk_matrix_regs_set {
> >   	bool	bIQKDone;
> > -	s32	Value[1][IQK_Matrix_REG_NUM];
> > +	s32	Value[][IQK_Matrix_REG_NUM];
> >   };
> >
>
> you are changing the actual size of the struct. Wondering if you have tested
> this patch somehow

Hello Pavel,
Thank you for reviewing the patch. I build the module post making the changes an
ensured that the build is successful. However, I am not sure how to check the
changes I am proposing. Could you please direct me to some information on how to
test patches? Is there some documentation generic/driver-specific that I can
refer to?

>
> >   struct odm_rf_cal {
> > diff --git a/drivers/staging/r8188eu/include/wlan_bssdef.h b/drivers/staging/r8188eu/include/wlan_bssdef.h
> > index 831c465df500..33177de194eb 100644
> > --- a/drivers/staging/r8188eu/include/wlan_bssdef.h
> > +++ b/drivers/staging/r8188eu/include/wlan_bssdef.h
> > @@ -179,7 +179,7 @@ struct ndis_802_11_status_ind {
> >
> >   struct ndis_802_11_auth_evt {
> >   	struct ndis_802_11_status_ind       Status;
> > -	struct ndis_802_11_auth_req  Request[1];
> > +	struct ndis_802_11_auth_req  Request[];
> >   };
> >
>
> this structure seems to be unused. Better to remove it instead of
> maintaining the old code

Sounds good. I agree and will do as suggested.

>
> >   struct ndis_802_11_test {
> > @@ -291,7 +291,7 @@ struct pmkid_candidate {
> >   struct ndis_802_11_pmkid_list {
> >   	u32 Version;       /*  Version of the structure */
> >   	u32 NumCandidates; /*  No. of pmkid candidates */
> > -	struct pmkid_candidate CandidateList[1];
> > +	struct pmkid_candidate CandidateList[];
> >   };
>
> this one as well

Yes, same here.

>
> >
> >   struct ndis_802_11_auth_encrypt {
> > @@ -304,7 +304,7 @@ struct ndis_802_11_cap {
> >   	u32  Version;
> >   	u32  NoOfPMKIDs;
> >   	u32  NoOfAuthEncryptPairsSupported;
> > -	struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[1];
> > +	struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[];
> >   };
> >
> >   u8 key_2char2num(u8 hch, u8 lch);
> > --
> > 2.34.1
> >
>
> and this one as well

Yes, will do.

Thank you again for your feedback and suggestions.

./drv

>
> >
> >
>
>
>
>
>
> With regards,
> Pavel Skripkin
>



  reply	other threads:[~2022-10-28 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 12:56 [PATCH] staging: r8188eu: Use flexible-array for one length array member Deepak R Varma
2022-10-28 14:03 ` Pavel Skripkin
2022-10-28 14:11   ` Deepak R Varma [this message]
2022-10-28 14:43     ` Dan Carpenter
2022-11-02 19:19       ` Deepak R Varma
2022-11-03  5:22         ` Dan Carpenter
2022-11-03  5:25           ` Deepak R Varma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1vjKtM9druO2bSN@ubunlion \
    --to=drv@mailo.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=outreachy@lists.linux.dev \
    --cc=paskripkin@gmail.com \
    --cc=phil@philpotter.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.