Re: [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep

From: shenyang (M)
Date: Tue Aug 04 2020 - 21:58:18 EST




On 2020/8/5 2:34, Markus Elfring wrote:

+++ b/drivers/crypto/hisilicon/qm.c
@@ -1420,16 +1420,17 @@ static int qm_dbg_help(struct hisi_qm *qm, char *s)

+ s_tmp = s;
presult = strsep(&s, " ");
if (!presult) {
- kfree(s);
+ kfree(s_tmp);
return -EINVAL;
}

- kfree(s);
- return -EINVAL;
+ ret = -EINVAL;
+ goto free_tmp;

I suggest to add a jump target for the desired exception handling.

Regards,
Markus

.


Thanks for your review. There is only one error branch need to do
something uninit. So I think the jump is not necessary and will
affect code reading.:)

Thanks,
Yang