public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Muhammad Usama Anjum <musamaanjum@gmail.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8192e, rtl8192u: use correct notation to define pointer
Date: Tue, 27 Oct 2020 12:23:03 +0100	[thread overview]
Message-ID: <20201027112303.GA405023@kroah.com> (raw)
In-Reply-To: <20201026121435.GA782465@LEGION>

On Mon, Oct 26, 2020 at 05:14:35PM +0500, Muhammad Usama Anjum wrote:
> Use pointer notation instead of using array notation as info_element is
> a pointer not array.
> 
> Warnings from sparse:
> drivers/staging/rtl8192u/ieee80211/ieee80211.h:1013:51: warning: array of flexible structures
> drivers/staging/rtl8192u/ieee80211/ieee80211.h:985:51: warning: array of flexible structures
> drivers/staging/rtl8192u/ieee80211/ieee80211.h:963:51: warning: array of flexible structures
> drivers/staging/rtl8192u/ieee80211/ieee80211.h:996:51: warning: array of flexible structures
> drivers/staging/rtl8192u/ieee80211/ieee80211.h:974:51: warning: array of flexible structures
> 
> drivers/staging/rtl8192e/rtllib.h:832:48: warning: array of flexible structures
> drivers/staging/rtl8192e/rtllib.h:851:48: warning: array of flexible structures
> drivers/staging/rtl8192e/rtllib.h:805:48: warning: array of flexible structures
> drivers/staging/rtl8192e/rtllib.h:843:48: warning: array of flexible structures
> drivers/staging/rtl8192e/rtllib.h:821:48: warning: array of flexible structures
> 
> Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtllib.h              | 10 +++++-----
>  drivers/staging/rtl8192u/ieee80211/ieee80211.h | 12 ++++++------
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
> index b84f00b8d18b..1dab9c3d08a8 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -802,7 +802,7 @@ struct rtllib_authentication {
>  	__le16 transaction;
>  	__le16 status;
>  	/*challenge*/
> -	struct rtllib_info_element info_element[];
> +	struct rtllib_info_element *info_element;
>  } __packed;

Are you sure these changes are correct?  This isn't just a list of
structures after this at the end of the structure?

Please look at commit 5979afa2c4d1 ("staging: Replace zero-length array
with flexible-array member") which made most of these flexible arrays.

This is not a pointer, it really is an array, I think sparse is really
wrong here, be careful.

thanks,

greg k-h

  reply	other threads:[~2020-10-27 11:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 12:14 [PATCH] staging: rtl8192e, rtl8192u: use correct notation to define pointer Muhammad Usama Anjum
2020-10-27 11:23 ` Greg KH [this message]
2020-10-27 13:50   ` Dan Carpenter
2020-10-28  4:42   ` Luc Van Oostenryck
2021-02-04 14:51     ` Muhammad Usama Anjum

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=20201027112303.GA405023@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=musamaanjum@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox