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

Andy Shevchenko
2026-03-30T09:50:30Z

On Sun, Mar 29, 2026 at 09:30:26PM +1100, David Disseldorp wrote:

> There is a simple_strntoul() function used solely as a shortcut
> for hex2bin() with proper endianess conversions. Replace that
> and drop the unneeded function in the next changes.
>
> This implementation will abort if we fail to parse the cpio header,
> instead of using potentially bogus header values.

...

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

--
With Best Regards,
Andy Shevchenko