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 F0904E95A87 for ; Sun, 8 Oct 2023 00:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbjJHAvp (ORCPT ); Sat, 7 Oct 2023 20:51:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234498AbjJHAvb (ORCPT ); Sat, 7 Oct 2023 20:51:31 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B948D2123; Sat, 7 Oct 2023 17:50:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 114E3C116A4; Sun, 8 Oct 2023 00:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696726222; bh=MG9L4M4zzrxBfJLAjFsYE5Goau+gW+6Vb5qsG20xPhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yw72EsTfuQallSjgEYr9osfhujkCVIKs81Cb3Wm+N5U1INGGFswlFKDowT+acwPLL CsU61IqcTuKpdeEXTJtBFnkzv5NgJ/3CFNp2Y+wK8noSTOYjs4bQm51wsojpro6/T1 P3p8TjnR9+MZRfUHsXv5u8bR4ORLkcRJzPb+H44QQBEjRp3l6IdyH4GGHAUQBiWbuB b/JWJvMjMrIjOV/CVqSIJ0nUCnFGe/yMPtDkX8U45QI5HdhPGb5+FGem4QxCMYBAoc /gpY+2+PfhDSSK8Cs26Yclyop+RGvDnIf1QNT7DiCtFSbsKHJPxwfO46U4/YNJ5XvK rmpnTq0y1SOSQ== 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 5.10 7/8] ata: libata-eh: Fix compilation warning in ata_eh_link_report() Date: Sat, 7 Oct 2023 20:50:08 -0400 Message-Id: <20231008005009.3768314-7-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008005009.3768314-1-sashal@kernel.org> References: <20231008005009.3768314-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 5.10.197 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 973f4d34d7cda..5c9792dd3ab61 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2224,7 +2224,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