From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35291C433F5 for ; Fri, 11 Mar 2022 14:00:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349019AbiCKOB1 (ORCPT ); Fri, 11 Mar 2022 09:01:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349018AbiCKOBY (ORCPT ); Fri, 11 Mar 2022 09:01:24 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F90C1C4B38; Fri, 11 Mar 2022 06:00:17 -0800 (PST) Received: from fraeml704-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KFSFp1xr9z67yL5; Fri, 11 Mar 2022 21:58:38 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml704-chm.china.huawei.com (10.206.15.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Fri, 11 Mar 2022 15:00:14 +0100 Received: from [10.47.87.13] (10.47.87.13) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.21; Fri, 11 Mar 2022 14:00:14 +0000 Message-ID: Date: Fri, 11 Mar 2022 14:00:13 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] perf parse-events: Fix null check To: Weiguo Li , , , CC: , , , , , References: From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.87.13] X-ClientProxiedBy: lhreml707-chm.china.huawei.com (10.201.108.56) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/03/2022 13:06, Weiguo Li wrote: > We did a null check after "tmp->symbol = strdup(...)", but we checked > "list->symbol" other than "tmp->symbol". > > Signed-off-by: Weiguo Li Reviewed-by: John Garry > --- > tools/perf/util/parse-events.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > index 9739b05b999e..dfb50a5f83d0 100644 > --- a/tools/perf/util/parse-events.c > +++ b/tools/perf/util/parse-events.c > @@ -2193,7 +2193,7 @@ int perf_pmu__test_parse_init(void) > for (i = 0; i < ARRAY_SIZE(symbols); i++, tmp++) { > tmp->type = symbols[i].type; > tmp->symbol = strdup(symbols[i].symbol); > - if (!list->symbol) > + if (!tmp->symbol) > goto err_free; > } >