RE: [EXT] Re: [PATCH] crypto: caam: Clear some memory in instantiate_rng()

From: Gaurav Jain
Date: Tue Mar 21 2023 - 01:04:59 EST


Hi Herbert

> -----Original Message-----
> From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, March 21, 2023 8:57 AM
> To: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> Cc: Horia Geanta <horia.geanta@xxxxxxx>; Pankaj Gupta
> <pankaj.gupta@xxxxxxx>; Gaurav Jain <gaurav.jain@xxxxxxx>;
> davem@xxxxxxxxxxxxx; linux-crypto@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [EXT] Re: [PATCH] crypto: caam: Clear some memory in
> instantiate_rng()
>
> Caution: EXT Email
>
> On Tue, Mar 21, 2023 at 12:45:43AM +0100, Christophe JAILLET wrote:
> > According to the comment at the end of the 'for' loop just a few lines
> > below, it looks needed to clear 'desc'.
> >
> > So it should also be cleared for the first iteration.
> >
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> > ---
> > This patch is speculative, but can't hurt.
> >
> > Maybe the memset() at the end of the 'for' loop could be removed instead.
>
> I think the memset can be removed. Horia?
memset() is needed to clear the desc for each state handle before recreating descriptor.
So it is required.

Regards
Gaurav Jain
> --
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page:
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgondor
> .apana.org.au%2F~herbert%2F&data=05%7C01%7Cgaurav.jain%40nxp.com%
> 7C93eb192d0c734fc5105e08db29bc1da2%7C686ea1d3bc2b4c6fa92cd99c5c3
> 01635%7C0%7C0%7C638149660155476281%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3
> D%7C3000%7C%7C%7C&sdata=S%2Bh6BA5ka9HoWb%2BHq8Vwb3TwnEu8b
> RZ5scpGvOxg8iw%3D&reserved=0
> PGP Key:
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgondor
> .apana.org.au%2F~herbert%2Fpubkey.txt&data=05%7C01%7Cgaurav.jain%4
> 0nxp.com%7C93eb192d0c734fc5105e08db29bc1da2%7C686ea1d3bc2b4c6fa
> 92cd99c5c301635%7C0%7C0%7C638149660155476281%7CUnknown%7CTWF
> pbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV
> CI6Mn0%3D%7C3000%7C%7C%7C&sdata=7YT4gr8kviqJYFABOcg6UgZL3BceG
> 3oY4HUSUuUwAdg%3D&reserved=0