Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp367864ybt; Wed, 1 Jul 2020 00:01:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI6zABeE7mwlevMJ0VDF6foLialnKfsOIxcbd3ODaBz38Q7uKl9oMmom3PoQ3DhpnFkmRf X-Received: by 2002:a17:906:2e06:: with SMTP id n6mr21143813eji.34.1593586912138; Wed, 01 Jul 2020 00:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593586912; cv=none; d=google.com; s=arc-20160816; b=t7l0TTsg1RSde7hjV4ZSMb+TjRxQxlUrgJ/4jHH5s0Ucf9FLRL7LhFzlFZ55uHHywz ldxK6pvSM1aBnjfMqy7M0HBEtO5gd8mwshWcJzhWj3oCquahaWG5jhRPHKe59qBLkn0A nP2ysh3kSgzvSuBrAnF92s6nrOwDtm6JcGjNPbJ1qpr1G8uzvwGr+VB7fZyuSmIQQ3mN SCy7/58Dt+qPo+VfrE3BmxOh3I54Guq05WizRlWMBjY62d2aADQ7CiVVKlYewdRiEzoS 3KMA40ukPtkk7yRzin30aFoed5PVm7VJRjfUnIVzeZOUQwKRfRX4Cs3ZWBmpAJufNUZz F2+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=YtzawHegVTQmzYloTATqiDXaV80CsM8fZzxQZR74Y6g=; b=lqBFYy2Mn7dqQgfNblRjhM5oo1A3AEWhTOgfAr1YbI6sx1ECEA2zGA+FouJPNT+/h+ bp09rKyrWFc0b9kquKPtBMa5bzjkkWeDFKyNmH8ETM5iLEj2rfaet0edGvoF4wO2NKMF KfkgFMSuNideyh6D4NdiVmFWvA+ud0aGSlGQZchXv9VkBjwxqG5HAfS66X7rr56XDwG/ TmKJ0dAiMOvgaLCoJyiFlovZ84Q4UTxSN0vi3BQrgSM4e2XyjhzPqCd6dcDJrUKP/VOm xiYVqwXcW586NuG6xtB2El/uUxoym7dstdB9Yex+zO0MY3HAhBTCizECMHkrjBejjIE9 oSgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si2962267ejt.141.2020.07.01.00.01.20; Wed, 01 Jul 2020 00:01:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727997AbgGAHBS (ORCPT + 99 others); Wed, 1 Jul 2020 03:01:18 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7323 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727981AbgGAHBR (ORCPT ); Wed, 1 Jul 2020 03:01:17 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7CD06EEF3B31F218F357; Wed, 1 Jul 2020 15:01:15 +0800 (CST) Received: from [127.0.0.1] (10.74.173.29) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 1 Jul 2020 15:01:09 +0800 Subject: Re: [PATCH 1/9] crypto: hisilicon/qm - fix wrong release after using strsep To: , References: <1593428948-64634-1-git-send-email-shenyang39@huawei.com> <1593428948-64634-2-git-send-email-shenyang39@huawei.com> CC: , , From: "shenyang (M)" Message-ID: <5e8e524a-7670-549a-e551-7f4260f3794c@huawei.com> Date: Wed, 1 Jul 2020 15:01:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1593428948-64634-2-git-send-email-shenyang39@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.173.29] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2020/6/29 19:09, Yang Shen wrote: > From: Sihang Chen > > 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 I'm sorry I made mistake here of the email address. Soon I will fix this on v2. > Signed-off-by: Shukun Tan > --- > 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; > } >