Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp716915lqh; Thu, 28 Mar 2024 14:15:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzolFChr2per1a74s6M5XoaZVVtN7IebWJFIvlYW9dafpSq5Dhwr9ZkSmq7JUbbd7VOysDdOlYdmWJc8GTcqbByBo1sGTOIADfdnopjA== X-Google-Smtp-Source: AGHT+IGYALycWHC8XtKI9YHdO6knyRus/QY+7W4LVHLI8hjYcb16algHpBNmc3qUUPTI8iTUbm1Q X-Received: by 2002:a50:baa2:0:b0:568:d74f:bb8e with SMTP id x31-20020a50baa2000000b00568d74fbb8emr288425ede.3.1711660508196; Thu, 28 Mar 2024 14:15:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711660507; cv=pass; d=google.com; s=arc-20160816; b=zSJW/UZN7zJGJC3zpHHnGzGkfSG3bIPvIB9gYYjDuQ6toV49/J659a5512f3hUXKsA MnwlG3GS6BIX0tH81jZrPPV5hp9mORM0xaUFZuibUhzNjW+N4iRQX1yUrI1HzV245bnd g4rgGPqdzKnLOiO0wQBslnscXsxxkMP8zvJ20iaawCP0PGEY8GQ6KEjUsimf6iI0gS8S b3VD05XFnPELqHcJoPUotJMhyzZH/3o4PFnZ5QzIjVxe3J0Dk1NyxPSHs+QS02RW315v 62+c0OIWkiCkLyA5z3ExQgxpYuOn3UhNGSrDi/v+/ecXTltZolX8HPCqTkPHpuN39Fgj li1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:from; bh=SsqM1H/CY4u+5xWeyxbzzZmp7dU7dcsDhnZZtUVn7gg=; fh=yL4nIgIx0vVUivnEK/jvkdQTrEk5ETLZK5ARwUA6gmM=; b=hrJPqG86cGyXDshS11w7hUpUpcqOOF8HG06dHs9TvlrfXtTBMK2DpZQ4UWt0rt1zcN TS21NMvxjGx17jVLePkAam6WYf7/E2RZ0CLq2y8PIef80RDOyWA5gF4MhymLh5ytDej0 YhuWTjn+p4KDSCy5eaRwWJT8mYfsSSihWSzI7VfkxeiJfgVtLYLclMACbTqqNZ3VBeTP BVfH9/nkCVqCtZb1EFrH7bN75APxHLGZgdxeT8c5BNx0Xlw29YOirTODVfrZ/B895Rxm c+naV0PFaOyEfPSbz4lQEczeiBCRdpsRpI7eZls4hJpcL/uP4wYdGfrRcBf1B3m9vLP0 2olQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=Bae5Bg09; arc=pass (i=1 spf=pass spfdomain=toke.dk dkim=pass dkdomain=toke.dk dmarc=pass fromdomain=toke.dk); spf=pass (google.com: domain of linux-wireless+bounces-5498-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5498-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i24-20020a508718000000b0056bd00515ffsi1125536edb.284.2024.03.28.14.15.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 14:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5498-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=Bae5Bg09; arc=pass (i=1 spf=pass spfdomain=toke.dk dkim=pass dkdomain=toke.dk dmarc=pass fromdomain=toke.dk); spf=pass (google.com: domain of linux-wireless+bounces-5498-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5498-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 03D521F22992 for ; Thu, 28 Mar 2024 21:15:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3E3E139593; Thu, 28 Mar 2024 21:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toke.dk header.i=@toke.dk header.b="Bae5Bg09" X-Original-To: linux-wireless@vger.kernel.org Received: from mail.toke.dk (mail.toke.dk [45.145.95.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C8581386DC; Thu, 28 Mar 2024 21:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.145.95.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711660501; cv=none; b=st69lM96BkQRmaOZaHSBhQ9TDcfOKY9ULyviznxm7GoHy4Hnqnv4pXSBXHMnq2cDVRXkvi4zwIjy9nHSnNPuzbkt7/A4WAF1Rn+nCbMDfa7ZUZT0cvYTBkkeeOKioROg4fSvQ66RK/zFluMoF4GuV1k112aEqhkYkRtyFbAGcMU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711660501; c=relaxed/simple; bh=9z0mgMAwNHiFsfGgfZzfnkUgXdttGFyaKKH2e0u+YYE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=VAdtqNc+Ye4Z+38czxX207WsL/vOaQMGHhG9kTr07ScxkQ7TVp0PKET53FEWNjkeCcQYm0TJKVeOULqLK/DeTe993kTvWm9aefjP377DymJaXmT0Tf3zNc/KTfHiOHsshU7rWakj+9MnzgO9GQrkq3+57nYN0fNVH1Gx/SvlpSk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=toke.dk; spf=pass smtp.mailfrom=toke.dk; dkim=pass (2048-bit key) header.d=toke.dk header.i=@toke.dk header.b=Bae5Bg09; arc=none smtp.client-ip=45.145.95.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=toke.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toke.dk From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1711660486; bh=9z0mgMAwNHiFsfGgfZzfnkUgXdttGFyaKKH2e0u+YYE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Bae5Bg09dsERm0deJ770aWjxUXnye6XJnSDNJGMUS930v86BsO1XwY1CVcuCmE82n d178rS8JltOeJ6rEglozEJzCbs+tjIOiQmgXSCzKcf6w6WkPpoDyJ5OlhCJO51JfKq mCs4/MoVcmrsY5bJVmTpdSvV2h9NxQnyOqjLpHsNcoRbH6gdVyDxdl0RGgrknqiSs4 +pM2rLnEXZmaSTBVbJT0OahnejWvlPvuchcpDPUiwsAiCD08l5qglPNV91781gN9Ll /JhVQRWptJPXu9y418lhwJhrh3ta0LoWB0SePlt4X465vuRBaGXk/CUm4CJJORAMoT br/ijvjmsh/Jg== To: Arnd Bergmann , Kees Cook , Kalle Valo Cc: linux-hardening@vger.kernel.org, linux-wireless@vger.kernel.org, Arnd Bergmann , Jeff Johnson , Dmitry Antipov , Hancheng Yang , Remi Pommarel , Johannes Berg , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] wifi: ath9k: work around memset overflow warning In-Reply-To: <20240328135509.3755090-3-arnd@kernel.org> References: <20240328135509.3755090-1-arnd@kernel.org> <20240328135509.3755090-3-arnd@kernel.org> Date: Thu, 28 Mar 2024 22:14:45 +0100 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87wmpm12ka.fsf@toke.dk> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Arnd Bergmann writes: > From: Arnd Bergmann > > gcc-9 and some other older versions produce a false-positive warning > for zeroing two fields > > In file included from include/linux/string.h:369, > from drivers/net/wireless/ath/ath9k/main.c:18: > In function 'fortify_memset_chk', > inlined from 'ath9k_ps_wakeup' at drivers/net/wireless/ath/ath9k/main= .c:140:3: > include/linux/fortify-string.h:462:25: error: call to '__write_overflow_f= ield' declared with attribute warning: detected write beyond size of field = (1st parameter); maybe use struct_group()? [-Werror=3Dattribute-warning] > 462 | __write_overflow_field(p_size_field, size= ); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Using a struct_group seems to reliably avoid the warning and > not make the code much uglier. The combined memset() should even > save a couple of cpu cycles. > > Signed-off-by: Arnd Bergmann Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen