[tip:,x86/microcode] x86/microcode/amd: Fix snprintf() format string warning in W=1 build
Message ID | 169758036182.3135.18264735357124966829.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4424222vqb; Tue, 17 Oct 2023 15:07:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHI2eimj/mhFhtXVhNU/HOtlwUwshropvKOVEuhxcP0xWZIBVKH/yox93eCGxTrMGeEcLaK X-Received: by 2002:a05:6871:468d:b0:1d5:1a99:537f with SMTP id ni13-20020a056871468d00b001d51a99537fmr3620806oab.2.1697580436403; Tue, 17 Oct 2023 15:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697580436; cv=none; d=google.com; s=arc-20160816; b=uQOUgVCp0f5GXBXYCXf51fObdp41SyEN2At/LJmK2s3XvuxhifdaD1nJiDblEc0LkX CGvjG+DSMoDTa5n/Xyv0qVk3bXWUuo9F8Bt93jhjTH+v41YHYyiwym9WEXLzFRMzXQAQ KMAqG+rBjuNuX3hDzG1ETzeq5ZSLuO30S8xf5OSXtb030xccnbnM+rcjXVOwP6KHVQZ7 l32gnE2eTpLQq/uPKHzgslcAdvLZZ+lEuGLWYspu1HPcqqIttcX5dwbKaos38Fe3fLZi K8WorneydrKFgLJ02i7fpKvg7SWKrBHRS2WiV1nygNbQyO0HHeKn115vfs1hD/X7VQJ4 lxPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=MIA4vCEdr5qmRgfJnFc6gfEBza2FMTeL6jD3+oV9ltA=; fh=5khAcWddL3PFDqJd4QEr1aMneqPyuOwCyEyZn1SiITg=; b=aLNZ9bPivoDdUBjCMfESNJjXts6lPf4NAUSja52uOslNNB2nOJiG38fvO+IwgKQeCw DdIYQ4kDZIyE05DOqbReXLxd2CwaKjra2sq5Fv5tjk/T7DrfpvUx7ROA//fm4rch90NN Euz9xgEGkn6eMjbRB3mhPkLwsjuCQDkI8Sb8f9oTNq7OcIsp+dW+km8su+1BbGbCle6u vsCvOrjByS/d96XD/Evb4/r5rSDD76Dz6I66V/m4WMmg+GmxVSem2LAxxyF2GpYMHovc q2a4hRKUf4vMXwS7lmWU86pdUYcMGsxJAEJY/r/VAWXb+CAjyxJV4jqdezANNvE2c7Fv vxFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xJdqr3dB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=jJ8kDqfw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id v190-20020a6389c7000000b005649f560ebesi638126pgd.525.2023.10.17.15.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 15:07:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xJdqr3dB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=jJ8kDqfw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1C3448083E5E; Tue, 17 Oct 2023 15:06:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234819AbjJQWGK (ORCPT <rfc822;winker.wchi@gmail.com> + 22 others); Tue, 17 Oct 2023 18:06:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbjJQWGI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Oct 2023 18:06:08 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF5CD3; Tue, 17 Oct 2023 15:06:06 -0700 (PDT) Date: Tue, 17 Oct 2023 22:06:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697580365; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MIA4vCEdr5qmRgfJnFc6gfEBza2FMTeL6jD3+oV9ltA=; b=xJdqr3dB92fJy4Ei0yuV7JpqsZLxQGvHpjy0U8TOF8Dxz4YfXdEgPhFlOUKsz2d20AjM8V 1MCjDyBrucKbfLwqOQEjmZ6Hiu8QWwL47sc4b05MOpB5MIshR7bQzbwACgS7CmSeD3QSRQ x6xMztrfVJomhjuy/9qn3GKlMlph6nvQXcxmUsYFby7SK9tv9gPV+qvy2+9xBXHH/I09Ce XcRClvqoHhR1ENlHJKzYMk1e263Vue//otgEwznGbK1fztaFIshlct3w5U3dlXRK1zwqq0 7Ro1hdXtRho1yQ70cT9W4smWIzq8bLbFVdjz+iR5s8/ZknFdDNKr0GYqrZyTnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697580365; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MIA4vCEdr5qmRgfJnFc6gfEBza2FMTeL6jD3+oV9ltA=; b=jJ8kDqfwX04hThJvuULdItASzP5tOFyeuCPPG/F++1lRae0k4rJI/XHex08OOYLABSEyOd Ph5HsHdA4A6wx8Aw== From: "tip-bot2 for Paolo Bonzini" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/microcode] x86/microcode/amd: Fix snprintf() format string warning in W=1 build Cc: kernel test robot <lkp@intel.com>, Paolo Bonzini <pbonzini@redhat.com>, Ingo Molnar <mingo@kernel.org>, "Borislav Petkov (AMD)" <bp@alien8.de>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231016224858.2829248-1-pbonzini@redhat.com> References: <20231016224858.2829248-1-pbonzini@redhat.com> MIME-Version: 1.0 Message-ID: <169758036182.3135.18264735357124966829.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 17 Oct 2023 15:06:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780002178138838657 X-GMAIL-MSGID: 1780042103274589240 |
Series |
[tip:,x86/microcode] x86/microcode/amd: Fix snprintf() format string warning in W=1 build
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Oct. 17, 2023, 10:06 p.m. UTC
The following commit has been merged into the x86/microcode branch of tip: Commit-ID: 2e9064faccd1a5b9de8c6f4b23d9f4948901cbe9 Gitweb: https://git.kernel.org/tip/2e9064faccd1a5b9de8c6f4b23d9f4948901cbe9 Author: Paolo Bonzini <pbonzini@redhat.com> AuthorDate: Mon, 16 Oct 2023 18:48:58 -04:00 Committer: Borislav Petkov (AMD) <bp@alien8.de> CommitterDate: Tue, 17 Oct 2023 23:51:58 +02:00 x86/microcode/amd: Fix snprintf() format string warning in W=1 build Building with GCC 11.x results in the following warning: arch/x86/kernel/cpu/microcode/amd.c: In function ‘find_blobs_in_containers’: arch/x86/kernel/cpu/microcode/amd.c:504:58: error: ‘h.bin’ directive output may be truncated writing 5 bytes into a region of size between 1 and 7 [-Werror=format-truncation=] arch/x86/kernel/cpu/microcode/amd.c:503:17: note: ‘snprintf’ output between 35 and 41 bytes into a destination of size 36 The issue is that GCC does not know that the family can only be a byte (it ultimately comes from CPUID). Suggest the right size to the compiler by marking the argument as char-size ("hh"). While at it, instead of using the slightly more obscure precision specifier use the width with zero padding (over 23000 occurrences in kernel sources, vs 500 for the idiom using the precision). Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Closes: https://lore.kernel.org/oe-kbuild-all/202308252255.2HPJ6x5Q-lkp@intel.com/ Link: https://lore.kernel.org/r/20231016224858.2829248-1-pbonzini@redhat.com --- arch/x86/kernel/cpu/microcode/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index bbd1dc3..b4eea8a 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -501,7 +501,7 @@ static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family) if (family >= 0x15) snprintf(fw_name, sizeof(fw_name), - "amd-ucode/microcode_amd_fam%.2xh.bin", family); + "amd-ucode/microcode_amd_fam%02hhxh.bin", family); if (firmware_request_builtin(&fw, fw_name)) { cp->size = fw.size;