Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp862694iol; Thu, 9 Jun 2022 16:07:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx83vmKdqW/8qL4Pml3oXzlwcwOo/PkwoTcbjYm+tse30bAKfegPeHWPJ3QROb3Xff63R4N X-Received: by 2002:a17:906:b053:b0:6fd:d8d5:5cac with SMTP id bj19-20020a170906b05300b006fdd8d55cacmr38091803ejb.370.1654816033255; Thu, 09 Jun 2022 16:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654816033; cv=none; d=google.com; s=arc-20160816; b=zayVdxsTue2E0rX/8nhWd1Gj1JRI9PdixdtaDD/zOUD2/7SHArwaG7ZqhZSZqSvIvi ICi9F6xLd/UB0+nOertlfdz3gPlk8ZYEgC/b4qUrtVsBnFEusPibEbRMkVVCL8onP34x CelIQr2DU5bmm7D+9KmtGdi8KQr9b1wqHGhJjqf/4qRk/SdeAF5qMCE70r4TTlGUyc/Z tkSE35LaYcNYmT3Xe2T8L5u0mZKdgdWZ3hqH61RuUnvV4TRLBbVsXaXASmDxuHVdV+tt hcPLnbwteNzIr+gmXzTEZegvfZV19MhQh7drbanGi8acWHArDMxrnBd/sEAkasgdC4K1 9eWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=SFFjvyZvefpU9NrWWzQ0TAmvQ8SzfCLTau1AjR7El54=; b=np4ebWNLks+jv8SEVRKirxXidG3E3Ex+wJ7oPlHs9/ehykSZGCkbz+guJbOr7sD0Gq rqncfXiCklIwQX5sve9ybJs+ZhrnWP0Xz6X/kFQ/97wcAQoDgwipZMw0Ac7n2F9vjjHj G8g6wgYzuMHcWPjplhLpjOuGWP5MpZ0WmY87IZFp0LpozsVTS4p0V2MivtqJqzL1coXl Y3jIaK8c5BRyA450Anneeyblbm7H/Rjy8JO0Yuqv8HvTj/F/t+ozds676gUudu/rH5cr D/n+euVDKp+GAP2Vb1jjELyk+S+WG2hn4ttR//otkR746GBjN+56ryxtRcn6VgUpJIvT xO+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Kr2RYZFW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr2-20020a170907720200b006fe9351816dsi11658358ejc.860.2022.06.09.16.06.47; Thu, 09 Jun 2022 16:07:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Kr2RYZFW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345571AbiFIWSI (ORCPT + 99 others); Thu, 9 Jun 2022 18:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345572AbiFIWSE (ORCPT ); Thu, 9 Jun 2022 18:18:04 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C44AA3D1C3 for ; Thu, 9 Jun 2022 15:18:02 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id z5-20020aa79f85000000b0051baa4e9fb8so12996185pfr.7 for ; Thu, 09 Jun 2022 15:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=SFFjvyZvefpU9NrWWzQ0TAmvQ8SzfCLTau1AjR7El54=; b=Kr2RYZFWYOeNjzG0DXVZ1PIX9XZMzBF03Z569egSujYX+SETM8BM22isVSs7ZYg0je vtmIi51QjRTMj1fwLrkgjqNVlwKBP1pP5HLG5JFnMd4QeQYx2K01nU1Ejrc/H0elX0dB xVMAEAznym96CzfG/aOkwGNw3H9g+blFPI7HqqKYy6VdsppoXnWpV0WmljI7FHufbK83 ON+xFi3394AkXlTQEdIEaihpVBJQ8PGsd812EFScZ5x0FGwt1QmokUw/eccZEX97Itvg V6YGaLMc68zBNDG7tvYESM8uNaTijhm4Fewwwm5H2YtyjsN07CoVm9f4qHoqAerZAXZJ XTVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=SFFjvyZvefpU9NrWWzQ0TAmvQ8SzfCLTau1AjR7El54=; b=NX3Fab4PAToI15oJlh7stMNXK7Jsj9rL5hFOJpuiCBrGip/2fsOJnAGyp1peRLr9jb Cp3JUca84XcHDdY4pKUyKdFxvJOtuR3m5fpuNRGdFjSu4loHFOaI0b6xo4wjJiDabA0n 4Herw3lxjAb/OAoI/6JiOA24kmz6dez2u4ptjKFmWGyYH4nmGWEzur7xuYwdMfdf25HJ z0u1jOC8bqhldAid/v8cK2MbNBj2F9ZT3HT08jPs+9u81IbZpLfd+VjUu7BwkraJzOO8 Q18o36V2wPWGJe9LLfDgDJQFeOn9bGGPhWnbvXdRaeHUFW/FY3F8c1xBBrkRMJ6sTFxT xfnA== X-Gm-Message-State: AOAM533SOpi/v2kWaFZBlUWKzEVcMAScuENkYQ4Y8quWql+8T49xp3Xq XslF3XP/i756wprvZn8SuLxSsdWr X-Received: from fawn.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5795]) (user=morbo job=sendgmr) by 2002:a63:35ce:0:b0:3fd:fb5a:a1c3 with SMTP id c197-20020a6335ce000000b003fdfb5aa1c3mr15000208pga.85.1654813082090; Thu, 09 Jun 2022 15:18:02 -0700 (PDT) Date: Thu, 9 Jun 2022 22:16:21 +0000 In-Reply-To: <20220609221702.347522-1-morbo@google.com> Message-Id: <20220609221702.347522-3-morbo@google.com> Mime-Version: 1.0 References: <20220609221702.347522-1-morbo@google.com> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog Subject: [PATCH 02/12] x86/CPU/AMD: use correct format characters From: Bill Wendling To: isanbard@gmail.com Cc: Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Phillip Potter , Arnd Bergmann , Greg Kroah-Hartman , "Rafael J. Wysocki" , Jan Kara , Andrew Morton , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jaroslav Kysela , Takashi Iwai , Nathan Chancellor , Nick Desaulniers , Tom Rix , Daniel Kiper , Ross Philipson , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, alsa-devel@alsa-project.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 From: Bill Wendling When compiling with -Wformat, clang emits the following warnings: arch/x86/kernel/cpu/mce/amd.c:1119:67: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] err = kobject_init_and_add(&b->kobj, &threshold_ktype, tb->kobj, get_name(cpu, bank, b)); ^~~~~~~~~~~~~~~~~~~~~~ arch/x86/kernel/cpu/mce/amd.c:1151:47: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] err = kobject_add(&b->blocks->kobj, b->kobj, b->blocks->kobj.name); ^~~~~~~~~~~~~~~~~~~~ arch/x86/kernel/cpu/mce/amd.c:1157:42: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] err = kobject_add(&pos->kobj, b->kobj, pos->kobj.name); ^~~~~~~~~~~~~~ arch/x86/kernel/cpu/mce/amd.c:1187:43: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] err = kobject_add(b->kobj, &dev->kobj, name); ^~~~ "%s", Use a string literal for the format string. Link: https://github.com/ClangBuiltLinux/linux/issues/378 Signed-off-by: Bill Wendling --- arch/x86/kernel/cpu/mce/amd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c index 1c87501e0fa3..d19bf0eb0abe 100644 --- a/arch/x86/kernel/cpu/mce/amd.c +++ b/arch/x86/kernel/cpu/mce/amd.c @@ -1116,7 +1116,8 @@ static int allocate_threshold_blocks(unsigned int cpu, struct threshold_bank *tb else tb->blocks = b; - err = kobject_init_and_add(&b->kobj, &threshold_ktype, tb->kobj, get_name(cpu, bank, b)); + err = kobject_init_and_add(&b->kobj, &threshold_ktype, tb->kobj, "%s", + get_name(cpu, bank, b)); if (err) goto out_free; recurse: @@ -1148,13 +1149,13 @@ static int __threshold_add_blocks(struct threshold_bank *b) struct threshold_block *tmp = NULL; int err = 0; - err = kobject_add(&b->blocks->kobj, b->kobj, b->blocks->kobj.name); + err = kobject_add(&b->blocks->kobj, b->kobj, "%s", b->blocks->kobj.name); if (err) return err; list_for_each_entry_safe(pos, tmp, head, miscj) { - err = kobject_add(&pos->kobj, b->kobj, pos->kobj.name); + err = kobject_add(&pos->kobj, b->kobj, "%s", pos->kobj.name); if (err) { list_for_each_entry_safe_reverse(pos, tmp, head, miscj) kobject_del(&pos->kobj); @@ -1184,7 +1185,7 @@ static int threshold_create_bank(struct threshold_bank **bp, unsigned int cpu, if (nb && nb->bank4) { /* yes, use it */ b = nb->bank4; - err = kobject_add(b->kobj, &dev->kobj, name); + err = kobject_add(b->kobj, &dev->kobj, "%s", name); if (err) goto out; -- 2.36.1.255.ge46751e96f-goog