Re: [PATCH][next] staging: wlan-ng: Replace one-element arrays with flexible-array members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 04, 2022 at 05:30:15PM -0600, Gustavo A. R. Silva wrote:
> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use “flexible array members”[1] for these cases. The older
> style of one-element or zero-length arrays should no longer be used[2].
> 
> This helps with the ongoing efforts to globally enable -Warray-bounds
> and get us closer to being able to tighten the FORTIFY_SOURCE routines
> on memcpy().
> 
> This issue was found with the help of Coccinelle and audited and fixed,
> manually.

How are you auditing this manually?  I have to re-audit it manually
myself as a reviewer and I'm find it tricky.

>  /*-- IBSS Parameter Set ---------------------------*/
> @@ -288,7 +288,7 @@ struct wlan_ie_ibss_parms {
>  struct wlan_ie_challenge {
>  	u8 eid;
>  	u8 len;
> -	u8 challenge[1];
> +	u8 challenge[];
>  } __packed;

This is dead code.  It would have been better to just delete that.  I
have a lot of experience at reviewing "Delete Dead Code" patches.

regards,
dan carpenter





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux