On Tue, 14 Dec 2021 00:20:05 +0100, David Disseldorp wrote: > --- a/init/initramfs.c > +++ b/init/initramfs.c > @@ -17,6 +17,8 @@ ... > -static void __init dir_add(const char *name, time64_t mtime) > -{ > - struct dir_entry *de = kmalloc(sizeof(struct dir_entry), GFP_KERNEL); > - if (!de) > - panic_show_mem("can't allocate dir_entry buffer"); > - INIT_LIST_HEAD(&de->list); > - de->name = kstrdup(name, GFP_KERNEL); > - de->mtime = mtime; > - list_add(&de->list, &dir_list); > -} ... > --- /dev/null > +++ b/init/initramfs_mtime.h ... > +static void __init dir_add(const char *name, time64_t mtime) > +{ > + struct dir_entry *de = kmalloc(sizeof(struct dir_entry), GFP_KERNEL); > + if (!de) > + panic("can't allocate dir_entry buffer"); > + INIT_LIST_HEAD(&de->list); > + de->name = kstrdup(name, GFP_KERNEL); > + de->mtime = mtime; > + list_add(&de->list, &dir_list); > +} I might as well fix the unhandled kstrdup() failure, rather than copying it here. I'll post another round which allocates the "name" buffer via the dir_entry kmalloc() call.