* Re: [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep
[not found] <96ffa633-dda1-7ad1-72da-5563906c1561@web.de>
@ 2020-08-05 1:58 ` shenyang (M)
[not found] ` <5554863d-f0d7-a396-7d13-e187fa9ca6bf@web.de>
0 siblings, 1 reply; 4+ messages in thread
From: shenyang (M) @ 2020-08-05 1:58 UTC (permalink / raw)
To: Markus Elfring, Sihang Chen, linux-crypto
Cc: linux-kernel, kernel-janitors, David S. Miller, Herbert Xu,
Zaibo Xu, Zhou Wang
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep
[not found] ` <5554863d-f0d7-a396-7d13-e187fa9ca6bf@web.de>
@ 2020-08-06 1:33 ` shenyang (M)
[not found] ` <c28f472c-4d7b-0afd-5ad7-3cc322aad404@web.de>
0 siblings, 1 reply; 4+ messages in thread
From: shenyang (M) @ 2020-08-06 1:33 UTC (permalink / raw)
To: Markus Elfring, Sihang Chen, linux-crypto
Cc: linux-kernel, kernel-janitors, David S. Miller, Herbert Xu,
Zaibo Xu, Zhou Wang
On 2020/8/5 14:04, Markus Elfring wrote:
>> 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.:)
>
> How does this concern fit to the Linux coding style?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=4da9f3302615f4191814f826054846bf843e24fa#n481
>
> Regards,
> Markus
>
> .
>
Got it, I'll fix this.
Thanks,
Yang
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep
[not found] ` <c28f472c-4d7b-0afd-5ad7-3cc322aad404@web.de>
@ 2020-08-07 8:06 ` shenyang (M)
0 siblings, 0 replies; 4+ messages in thread
From: shenyang (M) @ 2020-08-07 8:06 UTC (permalink / raw)
To: Markus Elfring, Sihang Chen, linux-crypto
Cc: linux-kernel, kernel-janitors, David S. Miller, Herbert Xu,
Zaibo Xu, Zhou Wang
On 2020/8/6 15:23, Markus Elfring wrote:
> Would you become interested to look if any other software components
> would be similarly affected?
Yeah, I'll check the rest and fix if any and send those in a
clean up patch.
Thanks,
Yang
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep
2020-08-04 13:58 [PATCH v4 00/10] crypto: hisilicon/qm - misc fixes Yang Shen
@ 2020-08-04 13:58 ` Yang Shen
0 siblings, 0 replies; 4+ messages in thread
From: Yang Shen @ 2020-08-04 13:58 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-kernel, linux-crypto, xuzaibo, wangzhou1
From: Sihang Chen <chensihang1@hisilicon.com>
Save the string address before pass to strsep, release it at end.
Because strsep will update the string address to point after the
token.
Fixes: c31dc9fe165d("crypto: hisilicon/qm - add DebugFS for xQC and...")
Signed-off-by: Sihang Chen <chensihang1@hisilicon.com>
Signed-off-by: Yang Shen <shenyang39@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
---
drivers/crypto/hisilicon/qm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 6527c53..ffb28cc 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -1420,16 +1420,17 @@ static int qm_dbg_help(struct hisi_qm *qm, char *s)
static int qm_cmd_write_dump(struct hisi_qm *qm, const char *cmd_buf)
{
struct device *dev = &qm->pdev->dev;
- char *presult, *s;
+ char *presult, *s, *s_tmp;
int ret;
s = kstrdup(cmd_buf, GFP_KERNEL);
if (!s)
return -ENOMEM;
+ s_tmp = s;
presult = strsep(&s, " ");
if (!presult) {
- kfree(s);
+ kfree(s_tmp);
return -EINVAL;
}
@@ -1459,7 +1460,7 @@ static int qm_cmd_write_dump(struct hisi_qm *qm, const char *cmd_buf)
if (ret)
dev_info(dev, "Please echo help\n");
- kfree(s);
+ kfree(s_tmp);
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-07 8:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <96ffa633-dda1-7ad1-72da-5563906c1561@web.de>
2020-08-05 1:58 ` [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep shenyang (M)
[not found] ` <5554863d-f0d7-a396-7d13-e187fa9ca6bf@web.de>
2020-08-06 1:33 ` [v4 " shenyang (M)
[not found] ` <c28f472c-4d7b-0afd-5ad7-3cc322aad404@web.de>
2020-08-07 8:06 ` shenyang (M)
2020-08-04 13:58 [PATCH v4 00/10] crypto: hisilicon/qm - misc fixes Yang Shen
2020-08-04 13:58 ` [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep Yang Shen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).