From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-sparse@vger.kernel.org, sparse@chrisli.org
Cc: luc.vanoostenryck@gmail.com
Subject: Re: [PATCH v2 0/4] add variadic format checking
Date: Mon, 5 Jan 2026 08:58:23 +0000 [thread overview]
Message-ID: <30d94564-382e-4cfe-b7ae-6fcabf95847b@codethink.co.uk> (raw)
In-Reply-To: <20251222160034.96188-1-ben.dooks@codethink.co.uk>
On 22/12/2025 16:00, Ben Dooks wrote:
> Second version of this, I think mostly sorting the issues
> identified in review.
>
> This series (which was initially sent back in 2020) adds the
> ability to deal with __attribute__((format) and checking the
> arguments to formatted variadic functions.
>
> I have been considering adding a -Wformat-linux to this as
> the kernel now has a number of extra formatting options and
> checking the type of these would be useful. An even nicer
> extension would be some way of informing the compiler/sparse
> of these at compile time (but would need to get agreement on
> how to do this with the compilers too)
Having tested on the kernel, there's a couple of issues with
this code, that i've mostly fixed.
Adding kernel type checking didn't come up with anything on
my riscv build other than a few signed v unsigned.
> Ben Dooks (4):
> parse: initial parsing of __attribute__((format))
> add -Wformat
> evaluate: check variadic argument types against formatting info
> tests: add varargs printf format tests
>
> Makefile | 1 +
> builtin.c | 4 +-
> evaluate.c | 14 +-
> evaluate.h | 10 +-
> options.c | 2 +
> options.h | 1 +
> parse.c | 83 ++++-
> sparse.1 | 8 +
> symbol.h | 10 +-
> validation/varargs-format-addrspace1.c | 36 ++
> validation/varargs-format-bad.c | 18 +
> validation/varargs-format-checking.c | 21 ++
> validation/varargs-format-position.c | 32 ++
> validation/varargs-format-prefix.c | 19 +
> validation/varargs-format-tests.c | 55 +++
> validation/varargs-type-formattest.c | 117 +++++++
> verify-format.c | 460 +++++++++++++++++++++++++
> verify-format.h | 6 +
> 18 files changed, 887 insertions(+), 10 deletions(-)
> create mode 100644 validation/varargs-format-addrspace1.c
> create mode 100644 validation/varargs-format-bad.c
> create mode 100644 validation/varargs-format-checking.c
> create mode 100644 validation/varargs-format-position.c
> create mode 100644 validation/varargs-format-prefix.c
> create mode 100644 validation/varargs-format-tests.c
> create mode 100644 validation/varargs-type-formattest.c
> create mode 100644 verify-format.c
> create mode 100644 verify-format.h
>
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html
prev parent reply other threads:[~2026-01-05 8:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 16:00 [PATCH v2 0/4] add variadic format checking Ben Dooks
2025-12-22 16:00 ` [PATCH v2 1/4] parse: initial parsing of __attribute__((format)) Ben Dooks
2025-12-22 16:00 ` [PATCH v2 2/4] add -Wformat Ben Dooks
2025-12-22 16:00 ` [PATCH v2 3/4] evaluate: check variadic argument types against formatting info Ben Dooks
2025-12-22 16:00 ` [PATCH v2 4/4] tests: add varargs printf format tests Ben Dooks
2026-01-05 8:58 ` Ben Dooks [this message]
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=30d94564-382e-4cfe-b7ae-6fcabf95847b@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=sparse@chrisli.org \
/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