Search Linux Wireless

[PATCH 4/4] wifi: ray_cs: fix stringop-truncation GCC warning

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

 



GCC 12.2 with W=1 warns:

drivers/net/wireless/legacy/ray_cs.c:630:17: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]

The driver uses SSID as a string which is just wrong, it should be treated as a
byte array instead. But as the driver is ancient and most likely there are no
users so convert it to use strscpy(). This makes sure that the string is
NUL-terminated and also the warning is fixed.

Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxx>
---
 drivers/net/wireless/legacy/ray_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
index 4b53a9c70e7e..8ace797ce951 100644
--- a/drivers/net/wireless/legacy/ray_cs.c
+++ b/drivers/net/wireless/legacy/ray_cs.c
@@ -627,7 +627,7 @@ static void init_startup_params(ray_dev_t *local)
 	local->sparm.b4.a_acting_as_ap_status = TYPE_STA;
 
 	if (essid != NULL)
-		strncpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE);
+		strscpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE);
 } /* init_startup_params */
 
 /*===========================================================================*/
-- 
2.30.2




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux