Re: [PATCH 1/3] crypto: hisilicon/qm - modify the process of regs dfx

From: Herbert Xu
Date: Fri Nov 04 2022 - 05:05:55 EST


On Sat, Oct 29, 2022 at 09:47:59AM +0000, Kai Ye wrote:
>
> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
> index 363a02810a16..832cfd9a7728 100644
> --- a/drivers/crypto/hisilicon/qm.c
> +++ b/drivers/crypto/hisilicon/qm.c
> @@ -1722,8 +1722,22 @@ static int qm_regs_show(struct seq_file *s, void *unused)
>
> DEFINE_SHOW_ATTRIBUTE(qm_regs);
>
> +static void dfx_regs_uninit(struct hisi_qm *qm,
> + struct dfx_diff_registers *dregs, int reg_len)
> +{
> + int i;
> +
> + /* Setting the pointer is NULL to prevent double free */
> + for (i = 0; i < reg_len; i++) {
> + kfree(dregs[i].regs);
> + dregs[i].regs = NULL;
> + }
> + kfree(dregs);
> + dregs = NULL;

What's the point of this last NULL assignment?

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt