From patchwork Mon Mar 22 16:02:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12155773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88495C433E1 for ; Mon, 22 Mar 2021 18:17:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 50AA660201 for ; Mon, 22 Mar 2021 18:17:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50AA660201 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A1B76E563; Mon, 22 Mar 2021 18:17:41 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 353626E505; Mon, 22 Mar 2021 16:05:07 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 2816A619AD; Mon, 22 Mar 2021 16:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616429107; bh=hZ+CAtng3yIYZIb+ah3e8qtw8iX8HVHsX0ExOcLMkVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dwkY1GeSKE6uqnx1AxEi3VFdRhYPg81cUVXGmS7VFECNmiWnHG9H8Xs03DE5r5UkI 2VYRrKWZEbiYE/8Go+UBgggdeU5IHX8PCQyERsMz4uhXvD8S/WDGEhcAqel5lYAhxx GH5OrCzsuWJ7MemQavOxq36ZBrGw8QsN0rHVPucenBu12gisEUNifGSz6+0j2xJ9ZZ bEVaUqft+/YBHP8/oDZqfcdvztMrcHT8BJQ3udH192n6G7X4gUnHIGCuLP1ptF/QU4 TnlXa1Qe8PUzWprVm8njgDc/yGpNfz20AWAFmYDGGOfZtOuyJUs4ZC7Fgr12Ezshk/ OxLRDx1pnNY1A== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Martin Sebor , Simon Kelley , Kalle Valo , "David S. Miller" , Jakub Kicinski Date: Mon, 22 Mar 2021 17:02:46 +0100 Message-Id: <20210322160253.4032422-9-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210322160253.4032422-1-arnd@kernel.org> References: <20210322160253.4032422-1-arnd@kernel.org> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 22 Mar 2021 18:17:39 +0000 Subject: [Intel-gfx] [PATCH 08/11] atmel: avoid gcc -Wstringop-overflow warning X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Lee Jones , linux-scsi@vger.kernel.org, x86@kernel.org, James Smart , tboot-devel@lists.sourceforge.net, ath11k@lists.infradead.org, Serge Hallyn , Arnd Bergmann , "James E.J. Bottomley" , Ning Sun , Anders Larsen , cgroups@vger.kernel.org, Pascal Terjan , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, "Gustavo A. R. Silva" , linux-security-module@vger.kernel.org, Tejun Heo , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Arnd Bergmann gcc-11 notices that the fields as defined in the ass_req_format structure do not match the actual use of that structure: cc1: error: writing 4 bytes into a region of size between 18446744073709551613 and 2 [-Werror=stringop-overflow=] drivers/net/wireless/atmel/atmel.c:2884:20: note: at offset [4, 6] into destination object ‘ap’ of size 6 2884 | u8 ap[ETH_ALEN]; /* nothing after here directly accessible */ | ^~ drivers/net/wireless/atmel/atmel.c:2885:20: note: at offset [4, 6] into destination object ‘ssid_el_id’ of size 1 2885 | u8 ssid_el_id; | ^~~~~~~~~~ This is expected here because the actual structure layout is variable. As the code does not actually access the individual fields, replace them with a comment and fixed-length array so prevent gcc from complaining about it. Signed-off-by: Arnd Bergmann --- drivers/net/wireless/atmel/atmel.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c index 707fe66727f8..ff9152d600e1 100644 --- a/drivers/net/wireless/atmel/atmel.c +++ b/drivers/net/wireless/atmel/atmel.c @@ -2881,13 +2881,18 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc) struct ass_req_format { __le16 capability; __le16 listen_interval; - u8 ap[ETH_ALEN]; /* nothing after here directly accessible */ - u8 ssid_el_id; - u8 ssid_len; - u8 ssid[MAX_SSID_LENGTH]; - u8 sup_rates_el_id; - u8 sup_rates_len; - u8 rates[4]; + u8 ssid_el[ETH_ALEN + 2 + MAX_SSID_LENGTH + 2 + 4]; + /* + * nothing after here directly accessible: + * + * u8 ap[ETH_ALEN]; + * u8 ssid_el_id; + * u8 ssid_len; + * u8 ssid[MAX_SSID_LENGTH]; + * u8 sup_rates_el_id; + * u8 sup_rates_len; + * u8 rates[4]; + */ } body; header.frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | @@ -2907,13 +2912,13 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc) body.listen_interval = cpu_to_le16(priv->listen_interval * priv->beacon_period); + ssid_el_p = body.ssid_el; /* current AP address - only in reassoc frame */ if (is_reassoc) { - memcpy(body.ap, priv->CurrentBSSID, ETH_ALEN); - ssid_el_p = &body.ssid_el_id; + memcpy(ssid_el_p, priv->CurrentBSSID, ETH_ALEN); + ssid_el_p += ETH_ALEN; bodysize = 18 + priv->SSID_size; } else { - ssid_el_p = &body.ap[0]; bodysize = 12 + priv->SSID_size; }