From patchwork Tue Oct 17 11:32:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 154087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4066593vqb; Tue, 17 Oct 2023 04:32:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEldJiLhhBPvMb7wDIRbDHAe/K0jK08UEpKEOJae3j14aPAub/3lkGGPCJFFNP6sEUBb9gq X-Received: by 2002:a17:902:bd07:b0:1ca:28f3:569a with SMTP id p7-20020a170902bd0700b001ca28f3569amr1896050pls.5.1697542360533; Tue, 17 Oct 2023 04:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697542360; cv=none; d=google.com; s=arc-20160816; b=twLryqatjQqVSvb8cVaWLm2wcincSnqgrALTDOvIglBGWfKB6W7/ZBUFPs/+MXw81z XqpCFjmKYIijavPi4sEZfIejrq1LIdCaICnZsok5haFQ3y/V0ZHwQwyFZj6/kJ7G8HKZ m/n/EbeNCsd+LagFXoISwVtsh8Rp9V7QAtHrIFzSeNPGlx6C5aFkwtE95FY+4oki0oF7 GtbA0I2blaX/1O2WG3WBugupL/YUy5MDsmqiXWnpkxZ0Y1A1f5aPQrhgzrchhDEsj0nQ X6r7tC2hn+EjYHqJH2JzSyB0CeXJMju34DC/oOphF3UPxcwVbvJOFwL6fl6oxY1Q25Fh Drug== 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=DSan9rdpM1NsI5fi39iHRLxEWkH6cCBOnQsKNslXLTQ=; fh=MUrH29im0GmYdZqwmxwpXAMEaZY08j2+JUrDCOik0gk=; b=xENeISp2YV6zg2MebpErP0W1Q2QDxYjQPe7d+IllnQdGHkoEscqCJ0V2eQh586VvJ3 QTFMmE2Vmrib68tF4IZDT+WEx1u83DGk7gk1l9ySQizAHXAOTaXV4FVv35ZMqX8akOzx GE/WmPg8UmgqMfEtXNEOKDtx67yeyI9vCAeoyZssPdUIwQVp3lMU2sA3NX1aFTMPbAUq HfR+TJ2yru+Utj/elXvYdBUH8pFKBGxpZRKNpi4N4VujyByZMLCl7nX49cW/oEKeKk1k Nb4zxknLT4BggHhUMgBfqmjC0yoljb8/B89QzZ9PmNEZyt0RPfxIyqQifUPhAZMyNjcJ bIHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=A2K9rBNY; dkim=neutral (no key) header.i=@linutronix.de header.b=xKCggJm2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id b11-20020a170902bd4b00b001c9d37ed06csi1451241plx.389.2023.10.17.04.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 04:32:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=A2K9rBNY; dkim=neutral (no key) header.i=@linutronix.de header.b=xKCggJm2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 2A9C5801D935; Tue, 17 Oct 2023 04:32:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234612AbjJQLcR (ORCPT + 19 others); Tue, 17 Oct 2023 07:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232134AbjJQLcQ (ORCPT ); Tue, 17 Oct 2023 07:32:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C54F9F; Tue, 17 Oct 2023 04:32:14 -0700 (PDT) Date: Tue, 17 Oct 2023 11:32:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697542333; 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=DSan9rdpM1NsI5fi39iHRLxEWkH6cCBOnQsKNslXLTQ=; b=A2K9rBNYKdhhbfHtC451hSTyhS/EUvAO0yCQHnwW/uqCWvS3yEI/9Lz5RaoMIy/b2aSfa+ caqH6TtIJWhSr+eyjbwFpWuKuUBT++ndYCNoAuUq/n7KNT259sPcFcVarS5kwAU8EookKw b5YmFJ1rzJV9PCxUcU2RWVPZMdMQLeWJ0RgkoP8Z1wFxTakInY1e6hC2YDS6s7kPUb9fy5 3l0DyniWmMYKXXbAnEDlEaHkiSMWqyRcOlFwwzficGGzYGY3gJO7ybXqgxMkmXP8CkL4d+ fNqyuRqecI1Q7lKvquKh/k8eeWdvm7VcZz+lrLXo4i9vYpTHEIq1X7ADo0ieBw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697542333; 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=DSan9rdpM1NsI5fi39iHRLxEWkH6cCBOnQsKNslXLTQ=; b=xKCggJm2nu7sbyAsna9cLmJ1zLcdD0JIwuJEsLT+v628AjuQMPy6+/3sMX3ZnRNgqFHkyo fX9a1izSBzudKdDA== From: "tip-bot2 for Paolo Bonzini" 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 , Paolo Bonzini , Ingo Molnar , 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: <169754233234.3135.10781923610428898414.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 17 Oct 2023 04:32:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780002178138838657 X-GMAIL-MSGID: 1780002178138838657 The following commit has been merged into the x86/microcode branch of tip: Commit-ID: 41a3e409e3e69892e9884b16b2fb6925e726f511 Gitweb: https://git.kernel.org/tip/41a3e409e3e69892e9884b16b2fb6925e726f511 Author: Paolo Bonzini AuthorDate: Mon, 16 Oct 2023 18:48:58 -04:00 Committer: Ingo Molnar CommitterDate: Tue, 17 Oct 2023 13:22:26 +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 Signed-off-by: Paolo Bonzini Signed-off-by: Ingo Molnar 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 8baa8ce..f3d0f99 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -485,7 +485,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;