[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210429142058.GC1981@kadam>
Date: Thu, 29 Apr 2021 17:20:58 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Jitendra Khasdev <jkhasdev@...il.com>
Cc: gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8192e: fix array of flexible structures
On Tue, Apr 27, 2021 at 11:19:45PM +0530, Jitendra Khasdev wrote:
> This patch fixes sparse warning "array of flexible structures"
> for rtllib.h.
>
> eg. drivers/staging/rtl8192e/rtllib.h:832:48: warning: array of
> flexible structures
>
> Signed-off-by: Jitendra Khasdev <jkhasdev@...il.com>
> ---
> drivers/staging/rtl8192e/rtllib.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
> index 4cabaf2..c7cb318 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;
This patch is wrong.
The original code is basically fine. Normally it doesn't make sense to
have an array of flex arrays, but in this case it "flexes" between 0 and
1. If it were had two elements then the match the math wouldn't work
at all.
We should probably get rid of it and just add some giant comments and
defines to do the math.
But changing it to a pointer isn't right.
regards,
dan carpenter
Powered by blists - more mailing lists