From 02b190f4c97758f7871d1301a68eb6a0bff2f365 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 8 Mar 2024 11:34:30 -0500 Subject: kernel: fs: Fix logic bug in initramfs code Return NULL if hdr is NULL, Before, if the file is not found, 0x200 would be returned instead of NULL. Signed-off-by: Ian Moffett --- sys/fs/initramfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/fs') diff --git a/sys/fs/initramfs.c b/sys/fs/initramfs.c index c0eaa0c..dad3763 100644 --- a/sys/fs/initramfs.c +++ b/sys/fs/initramfs.c @@ -221,7 +221,7 @@ initramfs_open(const char *path) } hdr = initramfs_from_path((void *)initramfs, path); - return hdr_to_contents(hdr); + return (hdr == NULL) ? NULL : hdr_to_contents(hdr); } struct vfsops g_initramfs_ops = { -- cgit v1.2.3