Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2801699rdg; Mon, 16 Oct 2023 15:50:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7Uzz4aceTErYdCnLakzX2DImne2FkVBAJXEO7DYXyMSgQ9yRDhRhvXRDc8VIY2DXWf6ey X-Received: by 2002:a17:90a:3042:b0:27d:bbee:578b with SMTP id q2-20020a17090a304200b0027dbbee578bmr270447pjl.7.1697496618927; Mon, 16 Oct 2023 15:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697496618; cv=none; d=google.com; s=arc-20160816; b=iORYztHIy4UB0IYWom3O/itu3ByYqD3DWdStTIaOI7Zw6Qi/17qVyRw19NmsUDlosM HZwdcy3F1mhhM87WxmUBsBRVJduiyWUXnrjXnm2vwOf4VeW2BaKCX4GzzU4CMFlTD/ep oYMqp5XyEvaVbynxq7UzIrZ1MF1lrycDOAHFS5gkauC8z/C+nZAbfETQOqL/xctG6ulA HMnHJTr1GPra/gQ1D4+ilwiFFgir5zAsGmLMxRKBdMlLXupkVVaQieSP8fdYitESdgwU pl9gJ/bXh/kl/1pL7E9C9oleR9Gjw3+kwlWdX7siHUXXwJ8RKinWMR4M/Wn0x9TfqgBX bxyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pYRuDFtRQm/XEND8LuUsFc5Ssln/FFt05O1wZEMzWlU=; fh=i8zl8rVulbZjGiZLD5ZXbhJTDaMyWGvLfUkpwJbDYOE=; b=Gu1piMgCdW8lryUGd8XwegiITh+7BPmrvQev3p759FDPBYAOPtbSjIFBvs0oP1yH64 Mv26qQ3msB6HVgtGdMf5Ocoomhv9uLvuLJT3YQ5wGXDLEvJN5lXqUqoW8p//tF6vz3Cw cxEcLNmHaLXGmJUqPl02WDNUBCIuTB2NNhD99cqPyRCHMoK58YOsKSovRGBnFMMqGc3Y TEKRBQ/x86YYYSgFdSWyV00U9PDx95M24cKsIPT5AouKQgzvnT5LjMThoP7e7tbMQ9ir yfpVCHYuoREplW6NSWEnIWGOZ+9bEBsRckzkJKkctYh7h8eiqv0vousGwHfZmbcRROly 8BIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cM2HwvFi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id pc2-20020a17090b3b8200b0027cd01b6caasi7920315pjb.47.2023.10.16.15.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 15:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cM2HwvFi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D72DC80267F2; Mon, 16 Oct 2023 15:50:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233664AbjJPWuO (ORCPT + 99 others); Mon, 16 Oct 2023 18:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233874AbjJPWuH (ORCPT ); Mon, 16 Oct 2023 18:50:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F5EBEE for ; Mon, 16 Oct 2023 15:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697496543; h=from:from: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; bh=pYRuDFtRQm/XEND8LuUsFc5Ssln/FFt05O1wZEMzWlU=; b=cM2HwvFiyKYE/fTNqqIOVy87fMAOQDAcZklj0k23odSGFJXH8q8yQqZfIuFQ2ZB5fks2LU d72MDJPUrz3Iya8vykX30hnTppgOMpXNi0fLXm7FDCPhyBqyddF7LfKgE+kk6tDbQpUtr4 Dv3Lh+FS4B1h5nc1+8dfnT4ZiAiDJO4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-450-_ocvPLeEPPCEzcjLSzAh1Q-1; Mon, 16 Oct 2023 18:48:59 -0400 X-MC-Unique: _ocvPLeEPPCEzcjLSzAh1Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C9283C1E9C5; Mon, 16 Oct 2023 22:48:59 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AAA025C9; Mon, 16 Oct 2023 22:48:59 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: kernel test robot Subject: [PATCH] x86/cpu: amd: fix warning in W=1 build Date: Mon, 16 Oct 2023 18:48:58 -0400 Message-Id: <20231016224858.2829248-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 15:50:18 -0700 (PDT) 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 Closes: https://lore.kernel.org/oe-kbuild-all/202308252255.2HPJ6x5Q-lkp@intel.com/ Signed-off-by: Paolo Bonzini --- 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 bbd1dc38ea03..b4eea8a1f68a 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; -- 2.39.1