Re: [RFC 1/2] lib/vsprintf: Add support for pte_t

From: Steven Rostedt
Date: Tue Jun 24 2025 - 10:32:45 EST


On Tue, 24 Jun 2025 14:11:08 +0100
Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:

> On Fri, Jun 20, 2025 at 01:42:53PM +0530, Anshuman Khandual wrote:
> > On 19/06/25 6:56 PM, Matthew Wilcox wrote:
> > > Unfortunately, the one example you've converted shows why this is a bad
> > > idea. You're passing a pmd_t pointer to a function which is assuming a
> > > pte_t pointer. And a pmd_t and a pte_t are sometimes different sizes!
> > > (eg sometimes one is 64 bit and the other 32 bit).
> >
> > As discussed on a separate thread, this might be addressed via separate
> > printf formats for each page table level e.g %ppte, %ppmd, and %ppud etc.
>
> There's still no typechecking!

There's lots of %pX formats that have no type checking. I think this is
an issue. Could we have one of the static checkers test these? Smatch,
sparse, whatever? Or maybe they do and I'm unaware of it?

-- Steve