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 X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B69AAC43461 for ; Tue, 15 Sep 2020 16:44:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 09FDD20731 for ; Tue, 15 Sep 2020 16:44:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="smDgWQxf"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jKyywHMk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09FDD20731 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uDMpD2t1ecEpZMfYhEJ67ijOTwb+QbUMVZDCpQnpQjM=; b=smDgWQxfqajwNOt4A8YwopY9o 3dGU/0SrEWm4X+sjxmO2kIv1ZS9qxbmkeEl11w34Ih0kSWPQPfIRPrODCE84ujvjU44GlB9CmE5x5 PY5AGeO7U3CnsBXiw2Kcz5Sy1J1PxxVSS9NBuDEFLqqf+uolPLbEHQy3QVBR7Pjm8VKpq3UhlZGY1 u1yiDZO1jqIS6ZH9B3KEnUHIsANFCkAufl/p8de2IszM05qE/f5wFlTQH2tKeWv++BXrxv1zBRWUU onbD3spzHOP64J6LQQoBbsWbbMPWCUzinfE2nri41bB4fsSFWb/nRkgJW9CMlDgl5g34IagVXW5Lr wbkHC2gpg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIE2l-0005y4-FX; Tue, 15 Sep 2020 16:42:59 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIE2h-0005xg-Ui for linux-arm-kernel@lists.infradead.org; Tue, 15 Sep 2020 16:42:57 +0000 Received: by mail-pg1-x543.google.com with SMTP id k14so2264082pgi.9 for ; Tue, 15 Sep 2020 09:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JLLGrdLqh4qJRGssyq/i3LorpQVxVznq1QtjCLG0J60=; b=jKyywHMk9cMq2RAh7bHuRyfQPo64ZR2N6Bt7L5skvpSjBvY8bT95WUG/THaARp1qFV 4FRjex+gTN5oa4tduFBixqRZ3DiD1GozMjsU57K9rB3jaLOUcHIapFhtPAgAwhnevCSP kqpASJhxloyGb5CKxJuRRpz8R/r9JguNfi1WmwUyY65TpyhCiVoMOHsOy7IbcbzL8muT tmzZewkdm74rZhqy7ZVHeSzLFL7viuwdvogJCip4aS0nDz+ShDw8cj8wk2RPtsz+UX7r LGW4sPeZC95oZrjCSksuxX3o3LU/jyC9TqEgjQbv80g3g8iJes7zDm9e2dwWXtA55+Iv czYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JLLGrdLqh4qJRGssyq/i3LorpQVxVznq1QtjCLG0J60=; b=o088u6pxSXx7tW54XlpteNPAuWRgmlaqzGv8jUe8DUfCLz1FW3zgYFjFoIMOHG3lkv AC9efRzFizJ7edrRJjQBdXIHRZU6U3UHNEGwjsM13I5VbxDQqLrJ+mg2V+mDQQJjZMF+ Q3qwn2aemgU06D0ywyX+pf2Ths/pEnvQqp+yKoeBhWt8cJJtIwQZE1PYOJ4VgaqePI8a BsO987fr4Gg7kXMnBItE8vfeZvjKW8o7vbRk50+9kaX1S9de2PH3AGkvSKmzCWC4iMIo 1uwLSyBSa9kHiw6Zgpr0NIIPu7XydRjI3GqFkQ74Ir3byS8SWcl/85lTDw9aYH6j5/Dl 3/ag== X-Gm-Message-State: AOAM533ZmhOEuVo2yIn4EwybXAQ0B+qX4MRfDSOu4dymaVCgg1/ULU0K sXRLbkidltWnw3FD/JIev0KpFw== X-Google-Smtp-Source: ABdhPJzOTrI/IyYryYih8Xym8JHwhKhEAETCb2fLrDJUe2AHfhSEW7tNmND2BLZ/8zVUGipzcZ3Izw== X-Received: by 2002:a63:594a:: with SMTP id j10mr14272280pgm.402.1600188171429; Tue, 15 Sep 2020 09:42:51 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b23sm86382pju.12.2020.09.15.09.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 09:42:50 -0700 (PDT) Date: Tue, 15 Sep 2020 10:42:48 -0600 From: Mathieu Poirier To: Jonathan Zhou Subject: Re: [PATCH RESEND v2] coresight: etm4x: Fix mis-usage of nr_resource in sysfs interface Message-ID: <20200915164248.GA3641338@xps15> References: <1600138437-61070-1-git-send-email-jonathan.zhouwen@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1600138437-61070-1-git-send-email-jonathan.zhouwen@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200915_124256_275487_F6DB9CAB X-CRM114-Status: GOOD ( 21.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shaokun Zhang , lizixian@hisilicon.com, Mike Leach , linux-arm-kernel@lists.infradead.org, Suzuki K Poulose Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 15, 2020 at 10:53:57AM +0800, Jonathan Zhou wrote: > The member @nr_resource represents how many resource selector pairs, > and the pair 0 is always implemented and reserved. > So let's multiply by 2 when resetting the seletor configuration. > And also update the validation of the input @idx. > > Cc: Mathieu Poirier > Cc: Suzuki K Poulose > Cc: Mike Leach > Cc: Shaokun Zhang > Cc: lizixian@hisilicon.com > Signed-off-by: Jonathan Zhou > --- > ChangeLog in v2: > * Address Mathieu's comments. > > drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) You send me two identical patches on the same day - the only difference was the RESEND had an capital 'f' in "Fix". That's the one I applied. Thanks, Mathieu > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c > index b673e738bc9a..e4f1f659000d 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c > @@ -236,7 +236,7 @@ static ssize_t reset_store(struct device *dev, > } > > config->res_idx = 0x0; > - for (i = 0; i < drvdata->nr_resource; i++) > + for (i = 2; i < 2 * drvdata->nr_resource; i++) > config->res_ctrl[i] = 0x0; > > config->ss_idx = 0x0; > @@ -1663,8 +1663,11 @@ static ssize_t res_idx_store(struct device *dev, > > if (kstrtoul(buf, 16, &val)) > return -EINVAL; > - /* Resource selector pair 0 is always implemented and reserved */ > - if ((val == 0) || (val >= drvdata->nr_resource)) > + /* > + * Resource selector pair 0 is always implemented and reserved, > + * namely an idx with 0 and 1 is illegal. > + */ > + if ((val < 2) || (val >= 2 * drvdata->nr_resource)) > return -EINVAL; > > /* > -- > 1.9.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel