From patchwork Tue May 5 14:33:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11529309 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 506FD81 for ; Tue, 5 May 2020 14:34:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41937206A5 for ; Tue, 5 May 2020 14:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729641AbgEEOeL (ORCPT ); Tue, 5 May 2020 10:34:11 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:46673 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbgEEOeL (ORCPT ); Tue, 5 May 2020 10:34:11 -0400 Received: from localhost.localdomain ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mof1D-1ila9N3wWf-00p29q; Tue, 05 May 2020 16:33:41 +0200 From: Arnd Bergmann To: Maya Erez , Kalle Valo , "David S. Miller" Cc: Arnd Bergmann , Dedy Lansky , Ahmad Masri , Alexei Avshalom Lazar , Tzahi Sabo , "Gustavo A. R. Silva" , Lior David , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning Date: Tue, 5 May 2020 16:33:24 +0200 Message-Id: <20200505143332.1398524-1-arnd@arndb.de> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:zDD9bs6aW0JYGWHkwYbnevv//40lQsm3jQwPwrI1bBnlk/bFmpk kZ7UaQ0Fyi+Sxj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x86WvWYTBaH24UoFOhAqbFfP8UPQ= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org gcc-10 warns about accesses inside of a zero-length array: drivers/net/wireless/ath/wil6210/cfg80211.c: In function 'wil_cfg80211_scan': drivers/net/wireless/ath/wil6210/cfg80211.c:970:23: error: array subscript 255 is outside the bounds of an interior zero-length array 'struct [0]' [-Werror=zero-length-bounds] 970 | cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1; | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/net/wireless/ath/wil6210/wil6210.h:17, from drivers/net/wireless/ath/wil6210/cfg80211.c:11: drivers/net/wireless/ath/wil6210/wmi.h:477:4: note: while referencing 'channel_list' 477 | } channel_list[0]; | ^~~~~~~~~~~~ Turn this into a flexible array to avoid the warning. Signed-off-by: Arnd Bergmann --- Gustavo has a patch to do it for all arrays in this file, and that should get merged as well, but this simpler patch is sufficient to shut up the warning. --- drivers/net/wireless/ath/wil6210/wmi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h index e3558136e0c4..5bba45c1de48 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.h +++ b/drivers/net/wireless/ath/wil6210/wmi.h @@ -474,7 +474,7 @@ struct wmi_start_scan_cmd { struct { u8 channel; u8 reserved; - } channel_list[0]; + } channel_list[]; } __packed; #define WMI_MAX_PNO_SSID_NUM (16)