Re: [PATCH v5 2/5] initramfs: add INITRAMFS_PRESERVE_MTIME Kconfig option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux