All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: wfx: avoid defining array of flexible struct
@ 2021-02-11 10:50 ` Muhammad Usama Anjum
  0 siblings, 0 replies; 6+ messages in thread
From: Muhammad Usama Anjum @ 2021-02-11 10:50 UTC (permalink / raw)
  To: jerome.pouiller, gregkh, devel, linux-kernel; +Cc: musamaanjum

In this particular case, the struct element is already flexible struct.
Thus struct element ie[] is ambiguous inside another struct. The members
of struct element ie aren't being accessed in code anywhere. The data of
u8 type is copied in it. So it has been changed to u8 ie[] to make the
sparse happy and code simple.

Warning from sparse:
drivers/stagingwfx/hif_tx.c: note: in included file (through drivers/stagingwfx/data_tx.h, drivers/staging//wfx/wfx.h):
drivers/staging//wfx/hif_api_cmd.h:103:26: warning: array of flexible structures

Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
---
 drivers/staging/wfx/hif_api_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
index 11bc1a58edae..58c9bb036011 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -100,7 +100,7 @@ struct hif_req_update_ie {
 	u8     reserved1:5;
 	u8     reserved2;
 	__le16 num_ies;
-	struct element ie[];
+	u8     ie[];
 } __packed;
 
 struct hif_cnf_update_ie {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] staging: wfx: avoid defining array of flexible struct
@ 2021-02-11 10:50 ` Muhammad Usama Anjum
  0 siblings, 0 replies; 6+ messages in thread
From: Muhammad Usama Anjum @ 2021-02-11 10:50 UTC (permalink / raw)
  To: jerome.pouiller, gregkh, devel, linux-kernel; +Cc: musamaanjum

In this particular case, the struct element is already flexible struct.
Thus struct element ie[] is ambiguous inside another struct. The members
of struct element ie aren't being accessed in code anywhere. The data of
u8 type is copied in it. So it has been changed to u8 ie[] to make the
sparse happy and code simple.

Warning from sparse:
drivers/stagingwfx/hif_tx.c: note: in included file (through drivers/stagingwfx/data_tx.h, drivers/staging//wfx/wfx.h):
drivers/staging//wfx/hif_api_cmd.h:103:26: warning: array of flexible structures

Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
---
 drivers/staging/wfx/hif_api_cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
index 11bc1a58edae..58c9bb036011 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -100,7 +100,7 @@ struct hif_req_update_ie {
 	u8     reserved1:5;
 	u8     reserved2;
 	__le16 num_ies;
-	struct element ie[];
+	u8     ie[];
 } __packed;
 
 struct hif_cnf_update_ie {
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: wfx: avoid defining array of flexible struct
  2021-02-11 10:50 ` Muhammad Usama Anjum
@ 2021-02-11 12:45   ` Jérôme Pouiller
  -1 siblings, 0 replies; 6+ messages in thread
From: Jérôme Pouiller @ 2021-02-11 12:45 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel, Muhammad Usama Anjum

On Thursday 11 February 2021 11:50:26 CET Muhammad Usama Anjum wrote:
> 
> In this particular case, the struct element is already flexible struct.
> Thus struct element ie[] is ambiguous inside another struct. The members
> of struct element ie aren't being accessed in code anywhere. The data of
> u8 type is copied in it. So it has been changed to u8 ie[] to make the
> sparse happy and code simple.

You may also mention that the driver code does not care of the type of
the ie attribute. It is only accessed from one place with memcpy().

> 
> Warning from sparse:
> drivers/stagingwfx/hif_tx.c: note: in included file (through drivers/stagingwfx/data_tx.h, drivers/staging//wfx/wfx.h):
> drivers/staging//wfx/hif_api_cmd.h:103:26: warning: array of flexible structures
> 
> Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
> ---
>  drivers/staging/wfx/hif_api_cmd.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
> index 11bc1a58edae..58c9bb036011 100644
> --- a/drivers/staging/wfx/hif_api_cmd.h
> +++ b/drivers/staging/wfx/hif_api_cmd.h
> @@ -100,7 +100,7 @@ struct hif_req_update_ie {
>         u8     reserved1:5;
>         u8     reserved2;
>         __le16 num_ies;
> -       struct element ie[];
> +       u8     ie[];
>  } __packed;
> 
>  struct hif_cnf_update_ie {
> --
> 2.25.1
> 
> 

I think that "#include <linux/ieee80211.h>" is no more necessary.

Else:

Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

-- 
Jérôme Pouiller



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: wfx: avoid defining array of flexible struct
@ 2021-02-11 12:45   ` Jérôme Pouiller
  0 siblings, 0 replies; 6+ messages in thread
From: Jérôme Pouiller @ 2021-02-11 12:45 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel, Muhammad Usama Anjum

On Thursday 11 February 2021 11:50:26 CET Muhammad Usama Anjum wrote:
> 
> In this particular case, the struct element is already flexible struct.
> Thus struct element ie[] is ambiguous inside another struct. The members
> of struct element ie aren't being accessed in code anywhere. The data of
> u8 type is copied in it. So it has been changed to u8 ie[] to make the
> sparse happy and code simple.

You may also mention that the driver code does not care of the type of
the ie attribute. It is only accessed from one place with memcpy().

> 
> Warning from sparse:
> drivers/stagingwfx/hif_tx.c: note: in included file (through drivers/stagingwfx/data_tx.h, drivers/staging//wfx/wfx.h):
> drivers/staging//wfx/hif_api_cmd.h:103:26: warning: array of flexible structures
> 
> Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
> ---
>  drivers/staging/wfx/hif_api_cmd.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
> index 11bc1a58edae..58c9bb036011 100644
> --- a/drivers/staging/wfx/hif_api_cmd.h
> +++ b/drivers/staging/wfx/hif_api_cmd.h
> @@ -100,7 +100,7 @@ struct hif_req_update_ie {
>         u8     reserved1:5;
>         u8     reserved2;
>         __le16 num_ies;
> -       struct element ie[];
> +       u8     ie[];
>  } __packed;
> 
>  struct hif_cnf_update_ie {
> --
> 2.25.1
> 
> 

I think that "#include <linux/ieee80211.h>" is no more necessary.

Else:

Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

-- 
Jérôme Pouiller


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: wfx: avoid defining array of flexible struct
  2021-02-11 12:45   ` Jérôme Pouiller
@ 2021-02-11 13:55     ` Muhammad Usama Anjum
  -1 siblings, 0 replies; 6+ messages in thread
From: Muhammad Usama Anjum @ 2021-02-11 13:55 UTC (permalink / raw)
  To: Jérôme Pouiller; +Cc: gregkh, devel, linux-kernel


> I think that "#include <linux/ieee80211.h>" is no more necessary.
Good catch. I'll send another patch.

Thanks,
Usama


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: wfx: avoid defining array of flexible struct
@ 2021-02-11 13:55     ` Muhammad Usama Anjum
  0 siblings, 0 replies; 6+ messages in thread
From: Muhammad Usama Anjum @ 2021-02-11 13:55 UTC (permalink / raw)
  To: Jérôme Pouiller; +Cc: devel, gregkh, linux-kernel


> I think that "#include <linux/ieee80211.h>" is no more necessary.
Good catch. I'll send another patch.

Thanks,
Usama

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-11 14:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 10:50 [PATCH] staging: wfx: avoid defining array of flexible struct Muhammad Usama Anjum
2021-02-11 10:50 ` Muhammad Usama Anjum
2021-02-11 12:45 ` Jérôme Pouiller
2021-02-11 12:45   ` Jérôme Pouiller
2021-02-11 13:55   ` Muhammad Usama Anjum
2021-02-11 13:55     ` Muhammad Usama Anjum

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.