lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Nov 2022 20:42:59 +0530
From:   Deepak R Varma <drv@...lo.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: staging/wlan-ng query: convert to flexible array member

Hello,

First, my apologies for the long email.
I am requesting guidance on how to approach resolving the zero element flexible
VLO struct implementation in this driver in file drivers/staging/waln-ng/hfa384x.f

The struct hfa384x_pdrec contains nested structs with zero element arrays.  These
zero element structs are part of a union 'data' inside the struct container. This
union 'data' is the last element of this container. Please see the code snip below:

<snip>

	1068 struct hfa384x_pdrec {
	   1         __le16 len;             /* in words */
	   2         __le16 code;
	   3         union pdr {
	   4                 struct hfa384x_pdr_pcb_partnum pcb_partnum;
	  11                 struct hfa384x_pdr_nicid nicid;
	  12                 struct hfa384x_pdr_refdac_measurements refdac_measurements;
	  13                 struct hfa384x_pdr_vgdac_measurements vgdac_measurements;
	  14                 struct hfa384x_pdr_level_comp_measurements level_compc_measurements;
	  15                 struct hfa384x_pdr_mac_address mac_address;
	  39         } data;
	  40 } __packed;

</snip>

The three structures in question are declared as follows in the same file:

<snip>
	962  struct hfa384x_pdr_refdac_measurements {
	   1         u16 value[0];
	   2 } __packed;
	   3
	   4 struct hfa384x_pdr_vgdac_measurements {
	   5         u16 value[0];
	   6 } __packed;
	   7
	   8 struct hfa384x_pdr_level_comp_measurements {
	   9         u16 value[0];
	  10 } __packed;
</snip>

As per the C99 specifications, the flexible array struct should have at least
one member other than the true flexible array member. So converting these from
[0] to [] is not feasible in the current form.

I did not find these struct variables being used for memory allocation in the
code directly. My find may be short since the implementation appears to get very
complex as I tried to get deeper.

Can you please suggest how should I approach correcting the zero element flex
array implementation here? Can these structs be removed if they are unused?

Thank you.
./drv



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ