Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp710487rwo; Wed, 2 Aug 2023 03:00:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlFKyTvZ7F1mrjtyj/VLIpSwIOdKvlU/1E0z9sJxMp8cTo7QAoCfwkBQ25+RWszVdVJ+0cns X-Received: by 2002:a05:6a00:1991:b0:662:f0d0:a77d with SMTP id d17-20020a056a00199100b00662f0d0a77dmr15364382pfl.30.1690970451370; Wed, 02 Aug 2023 03:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690970451; cv=none; d=google.com; s=arc-20160816; b=mtV87hucXuSLCT9n/tAWp7GyXkxWvz80aLFcqXsFIbmONVgl4PYBfaXTx6bdYvczPB qoGVgHOaPWAFrq0UEwDZFx26RIntQ0pPmlBHVsd56h/h3c8rkNSSIVHJ2RDavX9ylYTi M5XDtxmksdgdQvgpjdBhhmSJhaJGv+h7GRo3waR4QeJfgp/3wzugcm6jJc2hKUEzmrQG 3GZBJrIn6D4PDz9oL4JFVLmgPETIcg0IAuIR4rXFpKCSZPD2Q+kMVax2rFU3PjgAM83C RQA7WPP4BuLO8CeclDLTVMBL+F0YPy8VYsrPv50G8FqtWjH++FcBBeP+YDhLF02Yo/od yp/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=bS7YW2mUxbN7eLHGfOf7Qf7dsi2DFiGFS8sOfY3/14o=; fh=Z3ouNRhCSclCMTrR0+F/8knxoro1VrmxsFZPDBEyAYw=; b=A8Lg3kBUOTb1gzc/n4lIC03jH66fmqeciC1NaTy/uW1Q1ugiLpiZ6BW2hKy9kuZNQv 7ClCw96+dL5K8TtNeX8WF70FSsb4tx883OIPFyY9Z5Rr93V2/TRuj6vMDbI9oUuRc++r CLk0Ko29k/8nXfSoa9QiuuSRKHWv9vRt/64zNA5HTDXk1LBIwnHqdYM/9gAWoT94rb90 Vy2dGuPnBtqcTTKJEIgTtYqaAzWGQmYZZEWABBV1RG824Z0j5iGHJGnCh9MfyRLPowzT rpt5FPtjk2L9cIXz2D1xfAtNH0R+SXa9TQVGRbX77xSJ9uPzsRm62P5hSDqYL7GDRxxJ 6Opg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck9-20020a056a00328900b0068709992abfsi9014249pfb.324.2023.08.02.03.00.38; Wed, 02 Aug 2023 03:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232421AbjHBJrk (ORCPT + 99 others); Wed, 2 Aug 2023 05:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233451AbjHBJrf (ORCPT ); Wed, 2 Aug 2023 05:47:35 -0400 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0AA71FFA; Wed, 2 Aug 2023 02:47:33 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R711e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0VouZ2.I_1690969648; Received: from 30.221.150.97(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VouZ2.I_1690969648) by smtp.aliyun-inc.com; Wed, 02 Aug 2023 17:47:29 +0800 Message-ID: Date: Wed, 2 Aug 2023 17:47:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v5 1/5] perf metric: Event "Compat" value supports matching multiple identifiers To: John Garry Cc: Ian Rogers , Will Deacon , Mark Rutland , Robin Murphy , Ilkka Koskinen , Namhyung Kim , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-doc@vger.kernel.org, Zhuo Song , Shuai Xue References: <1690525040-77423-1-git-send-email-renyu.zj@linux.alibaba.com> <1690525040-77423-2-git-send-email-renyu.zj@linux.alibaba.com> <268b3891-be4b-5f63-eff3-7b6d83e906e9@oracle.com> <0801b73c-6649-8c54-8dca-276efc2a4967@linux.alibaba.com> <8e207c71-5400-5427-ae83-a1e0b8f95e31@linux.alibaba.com> From: Jing Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2023/8/2 下午5:43, John Garry 写道: > On 02/08/2023 10:38, Jing Zhang wrote: >>>>> n; >>>>> + >>>>> +    str = strdup(compat); >>>> why duplicate this? are you modifying something? >>>> >>> This is really a redundant step, I will remove it. >>> >> Hi John, >> >> I reviewed this code again and found that it still needs to duplicate "compat" because "compat" is a >> const str* type and cannot be used as a parameter for the strtok_r function. If it is cast to char*, >> using "compat" as a parameter for strtok_r is also unsafe and can cause a "Segmentation fault" error. >> Therefore, let's keep the step of duplicating "compat". > > ok, so then please add a small comment on why the strdup() call is needed. > No problem. Thanks, Jing