From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACD27E95A85 for ; Sun, 8 Oct 2023 00:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234323AbjJHAvG (ORCPT ); Sat, 7 Oct 2023 20:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234448AbjJHAun (ORCPT ); Sat, 7 Oct 2023 20:50:43 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6037D10F7; Sat, 7 Oct 2023 17:49:47 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09F77C433CA; Sun, 8 Oct 2023 00:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696726186; bh=5KotYUTkzsyrnu9qGiXLrjGII64q0hedJroY7+9qYk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hdz9bRrSsOj9HdxDmuz5X3J0aJzol3yZVZx/8HstywhH68OPmFIVF+W8lTmbYGNYS e+/9SELjk8h1GFKtAW4p+BEXJ2SErGUmpb6jiUcI9QU/u4hPrm3+xDN6x6kMcnuaKa u+MA3Oc2EXVXa/ZIKb9JFpfUpvONqXMZoLjGRCP1QT8JBDAwtotKXhuhbuUWshnHSW b1RYigXceVzC19j77mg2OtLpV58hpPQYWXAhJ4Y2fgkncvGb4s81bti8aaRcTxMeax 6IIdoxDq7uMJA55IS3rAF8F43mAxPO7QJuFbL5e7RikwX5f7v700c/56Y2GV7HAbct zU58e6lCB0p/w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Damien Le Moal , Hannes Reinecke , Geert Uytterhoeven , "Martin K . Petersen" , Sasha Levin , linux-ide@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 11/12] ata: libata-eh: Fix compilation warning in ata_eh_link_report() Date: Sat, 7 Oct 2023 20:49:28 -0400 Message-Id: <20231008004929.3767992-11-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008004929.3767992-1-sashal@kernel.org> References: <20231008004929.3767992-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.56 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Damien Le Moal [ Upstream commit 49728bdc702391902a473b9393f1620eea32acb0 ] The 6 bytes length of the tries_buf string in ata_eh_link_report() is too short and results in a gcc compilation warning with W-!: drivers/ata/libata-eh.c: In function ‘ata_eh_link_report’: drivers/ata/libata-eh.c:2371:59: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 4 [-Wformat-truncation=] 2371 | snprintf(tries_buf, sizeof(tries_buf), " t%d", | ^~ drivers/ata/libata-eh.c:2371:56: note: directive argument in the range [-2147483648, 4] 2371 | snprintf(tries_buf, sizeof(tries_buf), " t%d", | ^~~~~~ drivers/ata/libata-eh.c:2371:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 6 2371 | snprintf(tries_buf, sizeof(tries_buf), " t%d", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2372 | ap->eh_tries); | ~~~~~~~~~~~~~ Avoid this warning by increasing the string size to 16B. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Tested-by: Geert Uytterhoeven Reviewed-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/ata/libata-eh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index a3ae5fc2a42fc..28b1fe644cfee 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2212,7 +2212,7 @@ static void ata_eh_link_report(struct ata_link *link) struct ata_eh_context *ehc = &link->eh_context; struct ata_queued_cmd *qc; const char *frozen, *desc; - char tries_buf[6] = ""; + char tries_buf[16] = ""; int tag, nr_failed = 0; if (ehc->i.flags & ATA_EHI_QUIET) -- 2.40.1