From: Kees Cook <kees@kernel.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Scott Wood <scottwood@freescale.com>,
Arnd Bergmann <arnd@arndb.de>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] clk: qoriq: avoid formwat string warning
Date: Fri, 20 Mar 2026 11:00:04 -0700 [thread overview]
Message-ID: <202603201059.1DA0210B@keescook> (raw)
In-Reply-To: <20260320151854.3465248-1-arnd@kernel.org>
Nit: $subject typo "formwat" -> "format", but otherwise looks good.
On Fri, Mar 20, 2026 at 04:18:49PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang-22 warns about the use of non-variadic format arguments passed into
> snprintf():
>
> drivers/clk/clk-qoriq.c:925:39: error: diagnostic behavior may be improved by adding the
> 'format(printf, 7, 8)' attribute to the declaration of 'create_mux_common' [-Werror,-Wmissing-format-attribute]
> 910 | static struct clk * __init create_mux_common(struct clockgen *cg,
> | __attribute__((format(printf, 7, 8)))
> 911 | struct mux_hwclock *hwc,
> 912 | const struct clk_ops *ops,
> 913 | unsigned long min_rate,
> 914 | unsigned long max_rate,
> 915 | unsigned long pct80_rate,
> 916 | const char *fmt, int idx)
> 917 | {
> 918 | struct clk_init_data init = {};
> 919 | struct clk *clk;
> 920 | const struct clockgen_pll_div *div;
> 921 | const char *parent_names[NUM_MUX_PARENTS];
> 922 | char name[32];
> 923 | int i, j;
> 924 |
> 925 | snprintf(name, sizeof(name), fmt, idx);
> | ^
> drivers/clk/clk-qoriq.c:910:28: note: 'create_mux_common' declared here
> 910 | static struct clk * __init create_mux_common(struct clockgen *cg,
>
> Rework this to pass the 'int idx' as a varargs argument, allowing the
> format string to be verified at the caller location.
>
> Fixes: 0dfc86b3173f ("clk: qoriq: Move chip-specific knowledge into driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Kees Cook <kees@kernel.org>
--
Kees Cook
next prev parent reply other threads:[~2026-03-20 18:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 15:18 [PATCH] clk: qoriq: avoid formwat string warning Arnd Bergmann
2026-03-20 18:00 ` Kees Cook [this message]
2026-03-24 0:16 ` Stephen Boyd
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=202603201059.1DA0210B@keescook \
--to=kees@kernel.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=mturquette@baylibre.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=sboyd@kernel.org \
--cc=scottwood@freescale.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