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

From: David Disseldorp

Date: Mon Mar 30 2026 - 06:46:06 EST


On Mon, 30 Mar 2026 12:55:16 +0300, Andy Shevchenko wrote:

> 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.

Looks good to me, Andy. I'll wait another day or so for any further
feedback and then send a v5 with this.

Thanks, David