pstore/zone: Don't clear memory twice
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 9 Mar 2024 08:24:27 +0000 (09:24 +0100)
committerKees Cook <keescook@chromium.org>
Sat, 9 Mar 2024 20:33:22 +0000 (12:33 -0800)
There is no need to call memset(..., 0, ...) on memory allocated by
kcalloc(). It is already zeroed.

Remove the redundant call.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/fa2597400051c18c6ca11187b0e4b906729991b2.1709972649.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/zone.c

index abca117725c8160dea67d6c8a6d811466e5538f0..694db616663f0fc15a624afa6cd4349d06e23ea3 100644 (file)
@@ -1217,7 +1217,6 @@ static struct pstore_zone **psz_init_zones(enum pstore_type_id type,
                pr_err("allocate for zones %s failed\n", name);
                return ERR_PTR(-ENOMEM);
        }
-       memset(zones, 0, c * sizeof(*zones));
 
        for (i = 0; i < c; i++) {
                zone = psz_init_zone(type, off, record_size);