Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1052832rdb; Fri, 19 Jan 2024 06:57:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IE65NggSK+UznwspIBI8SKvYlH7UZipSaCoEhDNKHl25kPXMs+rcRkqVS+CcF0o16ViexlP X-Received: by 2002:a05:620a:40d6:b0:783:89fe:509a with SMTP id g22-20020a05620a40d600b0078389fe509amr1236727qko.152.1705676249394; Fri, 19 Jan 2024 06:57:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705676249; cv=pass; d=google.com; s=arc-20160816; b=kqsW45mIH4258QLDduV28b1RFo8bJ+zAihKb5M/1y+l+NjHRQ5M66LXSrgC2844tVc W1OXLFzKlLi+Gg7nKyf9MIjlnOe3yhjIdo1e/q0dVfrgZH/pcmhqTTf6vtqwkMWbZnkh 2tuEYywxMYx0JJrfNy220dXI+jD7057l0MNDubNWJGWWCBF2RjBmihzRVyQwqzXhGCIH GK4ks2Z9hFTSa01i0tLTfn14FFMbfQBx8C3CMM8kGaLZXN7PKxygbcxgKfb1K8L/j2IN /wdYctpBqwH1FZUWYdnFy050xgBopLz1AluSLhZhIuyPbNQNg+5spXTYa5Ns9GMXEaJS hq5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0FJ3u8FQXRoqT7BwVNIx98aq+VUBYB6SO4lY5IMX48M=; fh=ZAmOGVsQGVdo33vrceCI/Dp17lORBaW7LzhyWDA/Aus=; b=ZZgYLmp3miAes7G5R/iG+fu8W7rYp65iqB7fiHlSY96+dYnzH8aLhz7GH/4+X0wzz9 df6vcOdSTHRMAvWMHnTSrKQswy0khWu6DBP6FZETYJz4Hp9OA8zuV+1NlSmVZUOHma5t FuFR/yBB/cV+IAtdkPQeC6LbKAg09+dfw30ZCkaBcF/EeqlPrPxdV+XislO3hkWPRsDB tfJx6+kXFpml5I9Pz+NUun2sGTGKyViVdkf2/Rw//yv3965CK3S1W3RoV3fJSgKNpT6A Py2GS5ceTsVR08s31ghEv+CEBOyLxTTSfjS8P88kMahPimWIsvdjM2N7S7FRdFQbwTtd mAMw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=saWR+B9B; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f5-20020a05620a20c500b0078377888dbfsi4710900qka.406.2024.01.19.06.57.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 06:57:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=saWR+B9B; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31293-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 223111C249F7 for ; Fri, 19 Jan 2024 14:57:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64AEA54746; Fri, 19 Jan 2024 14:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="saWR+B9B" 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 879835465D; Fri, 19 Jan 2024 14:56:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705676180; cv=none; b=fi9L+XotxtytZq+chlTr0aYHgDJri7VGiIR2IQnXW5ygLOmaNIcFCrjAWc4AbSyjA3VOZHYCK8RFFKRZFUUquktVCMmEEsJvAQsZbbtRvM59S4ociju5PtoPVCsLZDF6ByLJHb0YfABZ+1PDqwMJNXDMM6y0JLgel7dLfQlgrsI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705676180; c=relaxed/simple; bh=qHs04bjtpQIRD5zTdGPu5IZXoDqL4hhRu+sEHgltQV0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qKohVH54xS4uWzVznVROXMRVc+qkvlc9KMn+Fiq8C8dmGJVuKTER/2MZiwBMxgWxtcS2DB3VaUcYx9fTantYC5Ze24y6SJO90arZAvvD9CgjETDJCWQiNOo3id1tMjB4nJhwVw7H2sRg6gJvdIIGkDcWyhE05/IN8MkOUxUtF70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=saWR+B9B; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57FC9C433F1; Fri, 19 Jan 2024 14:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705676180; bh=qHs04bjtpQIRD5zTdGPu5IZXoDqL4hhRu+sEHgltQV0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=saWR+B9B9L6yDQk5YP+UwF5lhmfamU39f5eLZpY4n/aGzCzJoW/G8P2Fw5jVe5+g0 nap8LyzoALjJzxEj93SZWbo3LY0K+/LAvi6bNICEO8qmOHzARNK+3PXIe8rMRa8Lri wekHJ1hP1AooS+spxD4UZXQiZdrYkgp/d5MoTvL5otdLzCT2H7DhpSgyfySb+wSNL7 FcZq/a2zhkoZ+dujiddJpkvWUdVF0wTRSOVtpJc15aToPSerSjDpbeUiv99XpPmIsc AAdH4j/FftzPN30bzPfwuG8VJCsvTWf+S9L8707gM6uiA4dEZR3kH7gMgh91CEHe04 ZCbQSLwkJscqQ== Date: Fri, 19 Jan 2024 14:56:14 +0000 From: Simon Horman To: Kunwu Chan Cc: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jacob.e.keller@intel.com, przemyslaw.kitszel@intel.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: Re: [PATCH v3] igb: Fix string truncation warnings in igb_set_fw_version Message-ID: <20240119145614.GB89683@kernel.org> References: <20240115082825.28343-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240115082825.28343-1-chentao@kylinos.cn> On Mon, Jan 15, 2024 at 04:28:25PM +0800, Kunwu Chan wrote: > Commit 1978d3ead82c ("intel: fix string truncation warnings") > fixes '-Wformat-truncation=' warnings in igb_main.c by using kasprintf. > > drivers/net/ethernet/intel/igb/igb_main.c:3092:53: warning:‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 13 [-Wformat-truncation=] > 3092 | "%d.%d, 0x%08x, %d.%d.%d", > | ^~ > drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note:directive argument in the range [0, 65535] > 3092 | "%d.%d, 0x%08x, %d.%d.%d", > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note:directive argument in the range [0, 65535] > drivers/net/ethernet/intel/igb/igb_main.c:3090:25: note:‘snprintf’ output between 23 and 43 bytes into a destination of size 32 > > kasprintf() returns a pointer to dynamically allocated memory > which can be NULL upon failure. > > Fix this warning by using a larger space for adapter->fw_version, > and then fall back and continue to use snprintf. > > Fixes: 1978d3ead82c ("intel: fix string truncation warnings") > Signed-off-by: Kunwu Chan > Cc: Kunwu Chan > Suggested-by: Jakub Kicinski Reviewed-by: Simon Horman