linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] wil6210: Avoid the use of one-element array
@ 2020-07-15 21:57 Gustavo A. R. Silva
  2020-07-22 18:27 ` Gustavo A. R. Silva
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2020-07-15 21:57 UTC (permalink / raw)
  To: Maya Erez, Kalle Valo, David S. Miller, Jakub Kicinski
  Cc: linux-wireless, wil6210, netdev, linux-kernel, Gustavo A. R. Silva

One-element arrays are being deprecated[1]. Replace the one-element
array with a simple value type 'u8 reserved'[2], once this is just
a placeholder for alignment.

[1] https://github.com/KSPP/linux/issues/79
[2] https://github.com/KSPP/linux/issues/86

Tested-by: kernel test robot <lkp@intel.com>
Link: https://github.com/GustavoARSilva/linux-hardening/blob/master/cii/0-day/wil6210-20200715.md
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/wireless/ath/wil6210/wmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h
index 9affa4525609..beb53cac329b 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.h
+++ b/drivers/net/wireless/ath/wil6210/wmi.h
@@ -3086,7 +3086,7 @@ struct wmi_scheduling_scheme_event {
 	/* wmi_sched_scheme_failure_type */
 	u8 failure_type;
 	/* alignment to 32b */
-	u8 reserved[1];
+	u8 reserved;
 } __packed;
 
 /* WMI_RS_CFG_CMDID - deprecated */
-- 
2.27.0


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

* Re: [PATCH][next] wil6210: Avoid the use of one-element array
  2020-07-15 21:57 [PATCH][next] wil6210: Avoid the use of one-element array Gustavo A. R. Silva
@ 2020-07-22 18:27 ` Gustavo A. R. Silva
  2020-07-23  6:43   ` Kalle Valo
  2020-07-22 19:40 ` Johannes Berg
  2020-08-14 14:47 ` Kalle Valo
  2 siblings, 1 reply; 7+ messages in thread
From: Gustavo A. R. Silva @ 2020-07-22 18:27 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Maya Erez, Kalle Valo, David S. Miller,
	Jakub Kicinski
  Cc: linux-wireless, wil6210, netdev, linux-kernel

Hi all,

Friendly ping: who can take this? :)

Thanks
--
Gustavo

On 7/15/20 16:57, Gustavo A. R. Silva wrote:
> One-element arrays are being deprecated[1]. Replace the one-element
> array with a simple value type 'u8 reserved'[2], once this is just
> a placeholder for alignment.
> 
> [1] https://github.com/KSPP/linux/issues/79
> [2] https://github.com/KSPP/linux/issues/86
> 
> Tested-by: kernel test robot <lkp@intel.com>
> Link: https://github.com/GustavoARSilva/linux-hardening/blob/master/cii/0-day/wil6210-20200715.md
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/net/wireless/ath/wil6210/wmi.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h
> index 9affa4525609..beb53cac329b 100644
> --- a/drivers/net/wireless/ath/wil6210/wmi.h
> +++ b/drivers/net/wireless/ath/wil6210/wmi.h
> @@ -3086,7 +3086,7 @@ struct wmi_scheduling_scheme_event {
>  	/* wmi_sched_scheme_failure_type */
>  	u8 failure_type;
>  	/* alignment to 32b */
> -	u8 reserved[1];
> +	u8 reserved;
>  } __packed;
>  
>  /* WMI_RS_CFG_CMDID - deprecated */
> 

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

* Re: [PATCH][next] wil6210: Avoid the use of one-element array
  2020-07-15 21:57 [PATCH][next] wil6210: Avoid the use of one-element array Gustavo A. R. Silva
  2020-07-22 18:27 ` Gustavo A. R. Silva
@ 2020-07-22 19:40 ` Johannes Berg
  2020-07-22 20:00   ` Gustavo A. R. Silva
  2020-08-14 14:47 ` Kalle Valo
  2 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2020-07-22 19:40 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Maya Erez, Kalle Valo, David S. Miller,
	Jakub Kicinski
  Cc: linux-wireless, wil6210, netdev, linux-kernel

On Wed, 2020-07-15 at 16:57 -0500, Gustavo A. R. Silva wrote:
> One-element arrays are being deprecated[1]. Replace the one-element
> array with a simple value type 'u8 reserved'[2], once this is just
> a placeholder for alignment.
> 
> [1] https://github.com/KSPP/linux/issues/79
> [2] https://github.com/KSPP/linux/issues/86

Umm, no, you're misinterpreting this ... This has nothing to do with
variable length and isn't used that way. As you can see from your own
patch, since you're not changing any users.

johannes


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

* Re: [PATCH][next] wil6210: Avoid the use of one-element array
  2020-07-22 19:40 ` Johannes Berg
@ 2020-07-22 20:00   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2020-07-22 20:00 UTC (permalink / raw)
  To: Johannes Berg, Gustavo A. R. Silva, Maya Erez, Kalle Valo,
	David S. Miller, Jakub Kicinski
  Cc: linux-wireless, wil6210, netdev, linux-kernel, Kees Cook



On 7/22/20 14:40, Johannes Berg wrote:
> On Wed, 2020-07-15 at 16:57 -0500, Gustavo A. R. Silva wrote:
>> One-element arrays are being deprecated[1]. Replace the one-element
>> array with a simple value type 'u8 reserved'[2], once this is just
>> a placeholder for alignment.
>>
>> [1] https://github.com/KSPP/linux/issues/79
>> [2] https://github.com/KSPP/linux/issues/86
> 
> Umm, no, you're misinterpreting this ... This has nothing to do with
> variable length and isn't used that way. As you can see from your own
> patch, since you're not changing any users.
> 

I understand that this 'reserved' field is being used merely for alignment
purposes:

drivers/net/wireless/ath/wil6210/wmi.h:

3080 /* WMI_SCHEDULING_SCHEME_EVENTID */
3081 struct wmi_scheduling_scheme_event {
3082         /* wmi_fw_status_e */
3083         u8 status;
3084         /* serial number given in command */
3085         u8 serial_num;
3086         /* wmi_sched_scheme_failure_type */
3087         u8 failure_type;
3088         /* alignment to 32b */
3089         u8 reserved[1];
3090 } __packed;

and that it's not being used as a variable-length array. The links are included
to inform the people about the reason why we are removing zero-length/one-element
arrays in the first place. The thing in this case is that it doesn't hurt to use
a simple value type instead of the one-element array form.

Thanks
--
Gustavo

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

* Re: [PATCH][next] wil6210: Avoid the use of one-element array
  2020-07-22 18:27 ` Gustavo A. R. Silva
@ 2020-07-23  6:43   ` Kalle Valo
  2020-07-24 18:29     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2020-07-23  6:43 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Gustavo A. R. Silva, Maya Erez, David S. Miller, Jakub Kicinski,
	linux-wireless, wil6210, netdev, linux-kernel

"Gustavo A. R. Silva" <gustavo@embeddedor.com> writes:

> Friendly ping: who can take this? :)

I'll take this if it's ok. I have been just busy due to vacation period.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH][next] wil6210: Avoid the use of one-element array
  2020-07-23  6:43   ` Kalle Valo
@ 2020-07-24 18:29     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2020-07-24 18:29 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Gustavo A. R. Silva, Maya Erez, David S. Miller, Jakub Kicinski,
	linux-wireless, wil6210, netdev, linux-kernel



On 7/23/20 01:43, Kalle Valo wrote:
> "Gustavo A. R. Silva" <gustavo@embeddedor.com> writes:
> 
>> Friendly ping: who can take this? :)
> 
> I'll take this if it's ok. I have been just busy due to vacation period.
> 

Thanks, Kalle. :)

--
Gustavo

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

* Re: [PATCH][next] wil6210: Avoid the use of one-element array
  2020-07-15 21:57 [PATCH][next] wil6210: Avoid the use of one-element array Gustavo A. R. Silva
  2020-07-22 18:27 ` Gustavo A. R. Silva
  2020-07-22 19:40 ` Johannes Berg
@ 2020-08-14 14:47 ` Kalle Valo
  2 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2020-08-14 14:47 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Maya Erez, David S. Miller, Jakub Kicinski, linux-wireless,
	wil6210, netdev, linux-kernel, Gustavo A. R. Silva

"Gustavo A. R. Silva" <gustavoars@kernel.org> wrote:

> One-element arrays are being deprecated[1]. Replace the one-element
> array with a simple value type 'u8 reserved'[2], once this is just
> a placeholder for alignment.
> 
> [1] https://github.com/KSPP/linux/issues/79
> [2] https://github.com/KSPP/linux/issues/86
> 
> Tested-by: kernel test robot <lkp@intel.com>
> Link: https://github.com/GustavoARSilva/linux-hardening/blob/master/cii/0-day/wil6210-20200715.md
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

I agree with Johannes, I don't see the point of this patch as there are
no clear benefits.

Patch set to Rejected.

-- 
https://patchwork.kernel.org/patch/11666325/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2020-08-14 14:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 21:57 [PATCH][next] wil6210: Avoid the use of one-element array Gustavo A. R. Silva
2020-07-22 18:27 ` Gustavo A. R. Silva
2020-07-23  6:43   ` Kalle Valo
2020-07-24 18:29     ` Gustavo A. R. Silva
2020-07-22 19:40 ` Johannes Berg
2020-07-22 20:00   ` Gustavo A. R. Silva
2020-08-14 14:47 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).