Message ID | 1593428948-64634-2-git-send-email-shenyang39@huawei.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Herbert Xu |
Headers | show |
Series | crypto: hisilicon/qm - misc fixes | expand |
On 2020/6/29 19:09, Yang Shen wrote: > 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@huawei.com> I'm sorry I made mistake here of the email address. Soon I will fix this on v2. > Signed-off-by: Shukun Tan <tanshukun1@huawei.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 9bb263c..ad0adcc 100644 > --- a/drivers/crypto/hisilicon/qm.c > +++ b/drivers/crypto/hisilicon/qm.c > @@ -1429,16 +1429,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; > } > > @@ -1468,7 +1469,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; > } >
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 9bb263c..ad0adcc 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -1429,16 +1429,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; } @@ -1468,7 +1469,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; }