Re: [RFC v3 3/7] mm: Use seprintf() instead of less ergonomic APIs

From: Marco Elver
Date: Mon Jul 07 2025 - 10:59:38 EST


On Mon, 7 Jul 2025 at 16:39, Alejandro Colomar <alx@xxxxxxxxxx> wrote:
>
> Hi Marco,
>
> On Mon, Jul 07, 2025 at 09:44:09AM +0200, Marco Elver wrote:
> > On Mon, 7 Jul 2025 at 07:06, Alejandro Colomar <alx@xxxxxxxxxx> wrote:
> > >
> > > While doing this, I detected some anomalies in the existing code:
> > >
> > > mm/kfence/kfence_test.c:
> > >
> > > - The last call to scnprintf() did increment 'cur', but it's
> > > unused after that, so it was dead code. I've removed the dead
> > > code in this patch.
> >
> > That was done to be consistent with the other code for readability,
> > and to be clear where the next bytes should be appended (if someone
> > decides to append more). There is no runtime dead code, the compiler
> > optimizes away the assignment. But I'm indifferent, so removing the
> > assignment is fine if you prefer that.
>
> Yeah, I guessed that might be the reason. I'm fine restoring it if you
> prefer it. I tend to use -Wunused-but-set-variable, but if it is not
> used here and doesn't trigger, I guess it's fine to keep it.

Feel free to make it warning-free, I guess that's useful.

> > Did you run the tests? Do they pass?
>
> I don't know how to run them. I've only built the kernel. If you point
> me to instructions on how to run them, I'll do so. Thanks!

Should just be CONFIG_KFENCE_KUNIT_TEST=y -- then boot kernel and
check that the test reports "ok".

Thanks,
-- marco