From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Arnd Bergmann" <arnd@kernel.org>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Tero Kristo <tero.kristo@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86/intel-uncore-freq: avoid non-literal format string
Date: Tue, 10 Jun 2025 10:20:28 -0700 [thread overview]
Message-ID: <825016aa048b95b4e5db9c26e9046d82fc4b6a84.camel@linux.intel.com> (raw)
In-Reply-To: <20250610093459.2646337-1-arnd@kernel.org>
On Tue, 2025-06-10 at 11:34 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Using a string variable in place of a format string causes a W=1
> build warning:
>
I am not able to reproduce with W=1 with gcc 15.1.1 20250521 (Red Hat
15.1.1-2).
$touch drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
common.c
$ make -j128 W=1
DESCEND objtool
CALL scripts/checksyscalls.sh
INSTALL libsubcmd_headers
.pylintrc: warning: ignored by one of the .gitignore files
CC [M] drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
common.o
LD [M] drivers/platform/x86/intel/uncore-frequency/intel-uncore-
frequency-common.o
But verified the change:
Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Thanks,
Srinivas
> drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.c:61:40: error: format string is not a string literal
> (potentially insecure) [-Werror,-Wformat-security]
> 61 | length += sysfs_emit_at(buf, length,
> agent_name[agent]);
> |
> ^~~~~~~~~~~~~~~~~
>
> Use the safer "%s" format string to print it instead.
>
> Fixes: b98fa870fce2 ("platform/x86/intel-uncore-freq: Add attributes
> to show agent types")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> .../x86/intel/uncore-frequency/uncore-frequency-common.c | 2
> +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-
> frequency-common.c b/drivers/platform/x86/intel/uncore-
> frequency/uncore-frequency-common.c
> index 0f8aea18275b..65897fae17df 100644
> --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.c
> +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.c
> @@ -58,7 +58,7 @@ static ssize_t show_agent_types(struct kobject
> *kobj, struct kobj_attribute *att
> if (length)
> length += sysfs_emit_at(buf, length, " ");
>
> - length += sysfs_emit_at(buf, length,
> agent_name[agent]);
> + length += sysfs_emit_at(buf, length, "%s",
> agent_name[agent]);
> }
>
> length += sysfs_emit_at(buf, length, "\n");
next prev parent reply other threads:[~2025-06-10 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 9:34 [PATCH] platform/x86/intel-uncore-freq: avoid non-literal format string Arnd Bergmann
2025-06-10 17:20 ` srinivas pandruvada [this message]
2025-06-13 8:48 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=825016aa048b95b4e5db9c26e9046d82fc4b6a84.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tero.kristo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox