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: 406164 Delivered-To: patch@linaro.org Received: by 2002:a17:906:5290:0:0:0:0 with SMTP id c16csp1348143ejm; Mon, 22 Mar 2021 09:05:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdy0iSud6OsLXQUGnORvkGpjBy8LNx7zftPaROyaxr2/8xMOeeb1uKn+/Sr4HRWAhfOS9Q X-Received: by 2002:a17:90a:c096:: with SMTP id o22mr68828pjs.119.1616429109921; Mon, 22 Mar 2021 09:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616429109; cv=none; d=google.com; s=arc-20160816; b=gFXyh6LA0StJCVKG3ex1ZeMmEq1zSW1hQWGRBXMoShfd+BWAuQWV0Ee5QJut2b5//s 8W24ivZ9xP1vII3XUrzu59gX/jj6Fq0+NYLfdOGLZVSgleQigMm8YV7MmK1ToF5g+2Zh 7Zwq9uhQivKYL0fQqbqOWv1+0c871v2colitNfIgkSLUJSVc2dbKqnzOPGe3JHEz132R nJ6pIvyWsPa6RlfHN35fwTdvX6uY7whj5uxVtRIJ1d94n1eTJYFVu1jbxr1CUnDs0cis LvkS3UucnJLtkjA3zsSG5jMKfSiNqz3+/wsw15lwJdnmP90UzExsJ+EPg85n8jyjKLWp O4yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to; bh=gQ82R8+cW81M4L5RfnsgOZAPK0f64dOtSUmzxRYe6KE=; b=Fvxg3HX8+60zW9pXIoTbmIoxKuUmUX+q/GCxSYi65cfwgA8ga3WDzzWppXGDd7g2yP 6U8EVsMYaPBs5QXW+fD/cdSuHCGvh2R2ROOsebim3o+Ly7LaobJUhIc6WfZ1pmzyWcL6 o9szEjsB/laPmexkrJfUX8GLpG8F5y8N5LxAZBln/Uew8J4my94Wx0ryqeZIBxj1Bu2l DpSQ9qKFSMvdgG/B+dm9xDLg/qKgf9YN2SSRCykzZYRikT5rbdeUAK1rINNR+iTtxYmm 6EL7XTXZbcwHCmkEDh/2Rcb9+htmYbPMfSLfOb6Vv/CUZvq/2Kp+u/EsFYap8bkp7jn5 +ZAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=dwkY1GeS; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id fv8si15617014pjb.92.2021.03.22.09.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 09:05:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=dwkY1GeS; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C888D6E509; Mon, 22 Mar 2021 16:05:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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 Subject: [PATCH 08/11] atmel: avoid gcc -Wstringop-overflow warning 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - 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: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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; }