Re: [PATCH v4 4/6] initramfs: Refactor to use hex2bin() instead of custom approach

From: Andy Shevchenko

Date: Mon Mar 30 2026 - 06:00:45 EST


On Mon, Mar 30, 2026 at 12:50:30PM +0300, Andy Shevchenko wrote:
> On Sun, Mar 29, 2026 at 09:30:26PM +1100, David Disseldorp wrote:

...

> > /*
> > * bogus newc header with "0x" prefixes on the uid, gid and namesize values.
> > - * parse_header()/simple_str[n]toul() accept this.
> > + * parse_header()/simple_str[n]toul() accepted this, contrary to the initramfs
> > + * specification. hex2bin() now fails.
> > */
> > #define CPIO_HDR_OX_INJECT \
> > "%s%08x%08x0x%06x0X%06x%08x%08x%08x%08x%08x%08x%08x0x%06x%08x%s"
>
> I think this change should be in patch 1.

Hmm... Re-reading it, seems the both needs to be updated.

For the patch 1:

* Bogus newc header with "0x" prefixes on the uid, gid, and namesize values.
* parse_header()/simple_str[n]toul() accept this, contrary to the initramfs
* specification.

For the patch 4:

* Bogus newc header with "0x" prefixes on the uid, gid, and namesize values.
* parse_header()/simple_str[n]toul() accepted this, contrary to the initramfs
* specification. hex2bin() now fails.

--
With Best Regards,
Andy Shevchenko