Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp69744rdb; Tue, 19 Dec 2023 09:33:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3RiFF3DfYMKc3XU69pQGMgTooxzx+9VjBauC6M+Pst7IR27XrcJMILn5TfCZcxX5BUQzn X-Received: by 2002:a05:6a00:419a:b0:6d8:835b:b0d1 with SMTP id ca26-20020a056a00419a00b006d8835bb0d1mr3674161pfb.5.1703007209392; Tue, 19 Dec 2023 09:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703007209; cv=none; d=google.com; s=arc-20160816; b=AEbMrr7fr0UD8tpm//w7V3bdSMj4leGdoXva4xF8Cn6qdWPkXMc4KdAluTrroRnZMV PBO45TVU78aN+rzP6tzqg6/r7oCeq8PG8tlyt4RsSAB7xIzKpu8lWy2CvdDumUr2osmx 7yBdUdEA3iQI906uItIW/3l1JIaG+DAHzoPvlwL8cuRtWqkRZqhDcQYcSJTsHO/Z1gMh D2XqJFSrc28mX0DymDWy9TxQUo8O25klgKXuM740qxddpmrpAc4sNP1mQhEDHAJ8Wjb1 euxpZI9hB0JGmBPvOe3zHX8RupRvRp3dP+QoAs9sgFp5lGi9p2j3pwPAqBIHVDyHpzY7 1nFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=vv3YUw2uGi2RY9bi2X4L8z3sYE/bKI+91xgWbHvLXJc=; fh=425/InZ20Hji6SnV2CjVhfF0tmoG50JFDPv3kvqvqro=; b=YYt6cjcDYFsPoDl2C4opr1ygEZ+0Q75B9Eizy0HPG+SlE4ceZ0sQL9rPiLuCHvL6DX WHXU3N2LWL50FMU0QSiCt3o1t5k2qVnv946v2uzSDv11f24FtgPXcnIWUBV2OO4sr0kM RA936R1SzrIm86CdzRyBqyPZzJL9lKVaogEHPFBfx2OH0WmNGhO0KecgaFsK/wdurmQ/ GuYg8mxpBb9U0LMCj7kHcd0quimtSqnJT5+vgwyU2GaOZgwcbxoaugPYAHR2f8kBUw0/ iLWcK2E58WAVAQ0ZuVaSDKufDBsy0eMTKPH3prITkxwcsc1/MaV/ueQq52W4qVt6L3lu 8G5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ud7EygRw; spf=pass (google.com: domain of linux-wireless+bounces-1001-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1001-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v11-20020a655c4b000000b005cd9ebd3b33si3657032pgr.796.2023.12.19.09.33.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:33:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1001-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ud7EygRw; spf=pass (google.com: domain of linux-wireless+bounces-1001-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1001-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DB2012861E7 for ; Tue, 19 Dec 2023 17:33:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E9AB341BA; Tue, 19 Dec 2023 17:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ud7EygRw" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 43ED8341AC for ; Tue, 19 Dec 2023 17:33:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DA3AC433C7; Tue, 19 Dec 2023 17:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703007204; bh=YV1viPAvkQj1veDTA8/RlWO8+ONFJQx0r0bJB5cx4OI=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=Ud7EygRwL0ADipNVOObBqNGjRQBQQqgn9cr9YZW+rxaExU0lAeOBIEA8pEsJqWPvR OcSr0dMNuGVQfAJhAJ5rZO9WtC/J3LG2TnXy4CNY5NIN5pvhKpo/LRWmsOMh/MV5wY OQNJKNIPfHCA1XoVOrBcR/jDm+z7sFupz4I36jWlPZJwrNZq/6l6Uj1rKb6rnRd5Fx bwG2YaWhelTp02x7gpKh+bhMbIrWdI0Hn8GYWgwotpJZ5MBqiTW5AylAu6DYqmVVse aOPY6GRtoc5HRAo8amFlK0pZl4JitdnQXxSeJTF5XGwNOGDtJcOCT9Luff/4rm6SBF ndi2dYQZDYVaA== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] wifi: p54: fix GCC format truncation warning with wiphy->fw_version From: Kalle Valo In-Reply-To: <20231219162516.898205-1-kvalo@kernel.org> References: <20231219162516.898205-1-kvalo@kernel.org> To: Kalle Valo Cc: linux-wireless@vger.kernel.org, chunkeey@googlemail.com User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <170300720199.899034.3258255171064401475.kvalo@kernel.org> Date: Tue, 19 Dec 2023 17:33:23 +0000 (UTC) Kalle Valo wrote: > GCC 13.2 warns: > > drivers/net/wireless/intersil/p54/fwio.c:128:34: warning: '%s' directive output may be truncated writing up to 39 bytes into a region of size 32 [-Wformat-truncation=] > drivers/net/wireless/intersil/p54/fwio.c:128:33: note: directive argument in the range [0, 16777215] > drivers/net/wireless/intersil/p54/fwio.c:128:33: note: directive argument in the range [0, 255] > drivers/net/wireless/intersil/p54/fwio.c:127:17: note: 'snprintf' output between 7 and 52 bytes into a destination of size 32 > > The issue here is that wiphy->fw_version is 32 bytes and in theory the string > we try to place there can be 39 bytes. wiphy->fw_version is used for providing > the firmware version to user space via ethtool, so not really important. > fw_version in theory can be 24 bytes but in practise it's shorter, so even if > print only 19 bytes via ethtool there should not be any practical difference. > > I did consider removing fw_var from the string altogether or making the maximum > length for fw_version 19 bytes, but chose this approach as it was the least > intrusive. > > Signed-off-by: Kalle Valo I forgot to include: Compile tested only. -- https://patchwork.kernel.org/project/linux-wireless/patch/20231219162516.898205-1-kvalo@kernel.org/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches