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]
Message-ID: <Y3YKhee8L+kAfHM4@qemulion>
Date:   Thu, 17 Nov 2022 15:48:45 +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
Cc:     gustavoars@...nel.org
Subject: [PATCH] staging: wlan-ng: Replace zero-length arrays with
 DECLARE_FLEX_ARRAY() helper

The code currently uses C90 standard extension based zero length arrays.
The zero length array member also happens to be the only member of the
structs. Such zero length array declarations are deprecated and the
new C99 standard extension of flexible array declarations are to be
used instead.

The DECLARE_FLEX_ARRAY() helper allows for a flexible array member as
the only member in a structure. Refer to these links [1], [2] for
details.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://lkml.kernel.org/r/YxKY6O2hmdwNh8r8@work

Issue identified using Coccinelle.

Signed-off-by: Deepak R Varma <drv@...lo.com>
---

Notes:
   1. Proposed change is compile tested only.
   2. Solution feedback from gustavoars@...nel.org


 drivers/staging/wlan-ng/hfa384x.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h
index 0611e37df6ac..3a1edcb43e07 100644
--- a/drivers/staging/wlan-ng/hfa384x.h
+++ b/drivers/staging/wlan-ng/hfa384x.h
@@ -960,15 +960,15 @@ struct hfa384x_pdr_nicid {
 } __packed;

 struct hfa384x_pdr_refdac_measurements {
-	u16 value[0];
+	DECLARE_FLEX_ARRAY(u16, value);
 } __packed;

 struct hfa384x_pdr_vgdac_measurements {
-	u16 value[0];
+	DECLARE_FLEX_ARRAY(u16, value);
 } __packed;

 struct hfa384x_pdr_level_comp_measurements {
-	u16 value[0];
+	DECLARE_FLEX_ARRAY(u16, value);
 } __packed;

 struct hfa384x_pdr_mac_address {
--
2.34.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ