[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea440f6c-577b-3733-0eb1-846d46559fb0@embeddedor.com>
Date: Wed, 22 Jul 2020 15:00:30 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Johannes Berg <johannes@...solutions.net>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Maya Erez <merez@...eaurora.org>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: linux-wireless@...r.kernel.org, wil6210@....qualcomm.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH][next] wil6210: Avoid the use of one-element array
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
Powered by blists - more mailing lists