fs/squashfs: zero out unused fields in fs_dirent
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 17 May 2021 06:21:39 +0000 (08:21 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 26 May 2021 21:26:07 +0000 (17:26 -0400)
When reading directories the UEFI sub-system must supply file attributes
and timestamps. These fields will have to be added to struct fs_dirent.
SquashFS should not fill these fields with random data. Ensure that they
are zeroed out.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
fs/squashfs/sqfs.c

index 29805c3..997be2d 100644 (file)
@@ -876,7 +876,7 @@ int sqfs_opendir(const char *filename, struct fs_dir_stream **dirsp)
        char **token_list = NULL, *path = NULL;
        u32 *pos_list = NULL;
 
-       dirs = malloc(sizeof(*dirs));
+       dirs = calloc(1, sizeof(*dirs));
        if (!dirs)
                return -EINVAL;