diff mbox series

pstore/zone: Don't clear memory twice

Message ID fa2597400051c18c6ca11187b0e4b906729991b2.1709972649.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Mainlined
Commit c8d25d696f526a42ad8cf615dc1131c0b00c662e
Headers show
Series pstore/zone: Don't clear memory twice | expand

Commit Message

Christophe JAILLET March 9, 2024, 8:24 a.m. UTC
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>
---
 fs/pstore/zone.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Kees Cook March 9, 2024, 8:33 p.m. UTC | #1
On Sat, 09 Mar 2024 09:24:27 +0100, Christophe JAILLET wrote:
> There is no need to call memset(..., 0, ...) on memory allocated by
> kcalloc(). It is already zeroed.
> 
> Remove the redundant call.
> 
> 

Applied to for-next/pstore, thanks!

[1/1] pstore/zone: Don't clear memory twice
      https://git.kernel.org/kees/c/c8d25d696f52

Take care,
diff mbox series

Patch

diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c
index abca117725c8..694db616663f 100644
--- a/fs/pstore/zone.c
+++ b/fs/pstore/zone.c
@@ -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);