From mboxrd@z Thu Jan 1 00:00:00 1970 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 560B21A72A for ; Fri, 24 Nov 2023 11:40:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SAPLy2dH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C08F6C433C7; Fri, 24 Nov 2023 11:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700826015; bh=zYX4CjsWwIjrMsq2uKCmc6hdvPNc+HvF1KoWV8vTooY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SAPLy2dHbO+E5r0XKsyj0RLhtiDKiepo8tz5yOCZhKJ5lio/dhCGp5YpbE6AjLLui wb17Hx6LUTORquA640FaTKuMFkUbomJg3Ji9RQOsWYEiw63ECYgjfkyQAsEABJc7kF kmcmScK3WdQ+HzELV5n7ufXb996oGnnjpJ5PpG0PWFX4uXrVh0aMk8MmP45kr3vUJ7 bMXxjdOFx5vrZnRtUpd7O1JYZpPoNi6odh7VHzHpClXiqJwdr5hvvtSCosZumUBx8J xmb03JKkaZIns/77LnULkK0+baECLS+pqpNiZmKmIziP1n5X0e+1HrxW/0TwNWzBg6 F2hNjI8rWkGbg== Date: Fri, 24 Nov 2023 11:40:11 +0000 From: Simon Horman To: Rahul Rameshbabu Cc: netdev@vger.kernel.org, Jakub Kicinski , Paolo Abeni , Eric Dumazet , "David S. Miller" , Saeed Mahameed , Gal Pressman , Dragos Tatulea , David Laight Subject: Re: [PATCH net v1 2/2] net/mlx5e: Correct snprintf truncation handling for fw_version buffer used by representors Message-ID: <20231124114011.GO50352@kernel.org> References: <20231121230022.89102-1-rrameshbabu@nvidia.com> <20231121230022.89102-2-rrameshbabu@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231121230022.89102-2-rrameshbabu@nvidia.com> On Tue, Nov 21, 2023 at 03:00:22PM -0800, Rahul Rameshbabu wrote: > snprintf returns the length of the formatted string, excluding the trailing > null, without accounting for truncation. This means that is the return > value is greater than or equal to the size parameter, the fw_version string > was truncated. > > Link: https://docs.kernel.org/core-api/kernel-api.html#c.snprintf > Fixes: 1b2bd0c0264f ("net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors") > Signed-off-by: Rahul Rameshbabu Reviewed-by: Simon Horman