
6 Oct
2017
6 Oct
'17
1:30 p.m.
On 06.10.2017 13:05, Prabhakar Kushwaha wrote:
Memory allocated via malloc is not guaranteed to be zeroized.
So explicitly memset the memory allocated via malloc.
Signed-off-by: Prabhakar Kushwaha prabhakar.kushwaha@nxp.com
drivers/net/fsl-mc/mc.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index 12dbcd8..c03d68f 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -730,6 +730,7 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr) printf(" No memory: malloc() failed\n"); return -ENOMEM; }
- memset(root_mc_io, 0, sizeof(struct fsl_mc_io));
Why not use calloc() instead of malloc()? You can drop the memset() then completely.
Thanks, Stefan