Re: [PATCH v3 0/6] initramfs: test and improve cpio hex header validation

From: David Disseldorp

Date: Mon Mar 23 2026 - 19:13:15 EST


On Mon, 23 Mar 2026 15:07:53 -0700, Andrew Morton wrote:

> On Mon, 23 Mar 2026 15:54:16 +0100 Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> > The series that introduced simple_strntoul() had passed into kernel
> > without proper review and hence reinvented a wheel that's not needed.
> > Here is the refactoring to show that. It can go via PRINTK or VFS
> > tree.
> >
> > I have tested this on x86, but I believe the same result will be
> > on big-endian CPUs (I deduced that from how strtox() works).
>
> AI review asked a few questions:
>
> https://sashiko.dev/#/patchset/20260323150054.3587083-1-andriy.shevchenko@xxxxxxxxxxxxxxx
>
> The "Is it possible for kzalloc() to fail and return NULL here?" one
> should be ignored - I've asked Roman&Chris to teach the reviewbot that
> unchecked allocations in __init code are OK.

The bot should ideally also consider KUNIT=y / INITRAMFS_TEST here. The
feedback regarding misuse of the new fill_cpio() fmt parameter is
valid, but my preference was to keep the initramfs test code simple.

If there's a concern that this test code may be copied into other parts
of the kernel, then I'd prefer to go with a different approach: drop the
fill_cpio() change and just call sprintf directly within
initramfs_test_hdr_hex().

Thanks, David