Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3055856pxb; Thu, 10 Feb 2022 11:11:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXOud6ey17x04QnZFSLSBQdCMxpZ/b1lR1REsJNiEw4KMIQxfXrlTl12gxi2npozG8xCxK X-Received: by 2002:aa7:d7d7:: with SMTP id e23mr9578201eds.185.1644520261185; Thu, 10 Feb 2022 11:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644520261; cv=none; d=google.com; s=arc-20160816; b=D68YD8xaMpa4bT+M/pt5CQv8/ClZu2fsSMduJpaxaL0uXpUkrnvOpiLDgrRjS/Pb0P wzThLDlcjmfdgGiQZW3tLpileC5hyZ8/9Wh+SNuevXwnBceso8Y4xQLSw61wXzPvnqdN KUIiEd/wuqe4RfeJ3gvYhFSuplG34PUBVkxmlgpnkcMyuzO0mJtl6bcXcYena6DN5Y3A cPzZ+yiG3m4qz93gEeeVeh4DWESxTg1G0rhSHlxTC6ALk02WXpZqtkLhFzNjWRHYKY+a /C1xLo7EzocC9Ipb2izK+HJ2N6SdzByfjYdxr/DrLMeEA01bjmnUeDYEdMTXQ9bM8J2D zPEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eJjpjiZFmC3NVaxARYWkgFsjJKrhv1BAcceimkRM1uc=; b=FdcqrFTrr4df2AwGZyaJ7qmfAlD9OzFNxOI7x+BXzHJE18Gw2cIpC8mdczWi11pqAH z9wtZvr3LLI0SRl0fXiM3eCYvKD5WCvdbS4uSi2+w1cgsG27dQsfbFWrgObk7oKCCJ9l QbfeZ2U2NjCjL2spOKQEpxuoWs59fB3BD2r9gm+QYus08H79HyZnKkqaAvrctOQfGOrY k2loCu3oWvl9JDFSIFbWyvFkB42I5CoK/YVRSJ+zeD3v4YDfEiH58Zs7ZESlmQG2i2y9 MhEjWmzNcvWPLFA+efATrNSKoBFf/bZRRjk1m3IArLhuu9r+ltAuWwZN4q1a0esjRenb k5GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I4hwIxjk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn37si17531798ejc.852.2022.02.10.11.10.36; Thu, 10 Feb 2022 11:11:01 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=I4hwIxjk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245437AbiBJR6w (ORCPT + 99 others); Thu, 10 Feb 2022 12:58:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245426AbiBJR6v (ORCPT ); Thu, 10 Feb 2022 12:58:51 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0A4BF5 for ; Thu, 10 Feb 2022 09:58:51 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id h7-20020a17090a648700b001b927560c2bso5137440pjj.1 for ; Thu, 10 Feb 2022 09:58:51 -0800 (PST) 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=eJjpjiZFmC3NVaxARYWkgFsjJKrhv1BAcceimkRM1uc=; b=I4hwIxjkkeAi4jIAR7EXdb4NWii/7oxAC6AKqPuQcnGc8TW/3D7Kxhqam1lyFsXflt Vm5HJqIQnwHvwhbzNaVZa/mGzfaowJ3SBRqQD0pO7VdYw06AMqhgorMLoVu687YW6uRy xkDO6nKGEP1GdnvBreXiy7Bzs/r8JG5ZY52itSe+2nWNR7aR/w54AI9EhT004OHlxO41 Zue5nM3Rjk/3mHOTvwbP6nVoO7O6C5tofS/BRIFKSU4np+suf7OKHgu8N9LUfARepCSh PX2O6hjyeqrkf2K0IX6MAgjAOqbTm0uSfwncU7ax0gdaHn259R4/6H92h5F65UBFMXJT ESLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eJjpjiZFmC3NVaxARYWkgFsjJKrhv1BAcceimkRM1uc=; b=m9Yl7iyR/ogiWfH9A7YZ6/Pj8Eu8NEXbZiXr7JbAZqqhGCDtJdC6eh65M0X++j/o+A zj9y7rFXtxcLsf4plYuqdw55diMfeNCldEo7YG3StQ7m6f+Ud6YrKBQm3MSXpG6YadRS ElP2gVGCHXpFhdEM34PhSgrOdVNIwFKksEZSDaj1MzafGlwSfebAGQ5rtaq54iWHoh4Y R1rEPrP1i83fRedA/aohIqnCEiMSAKtr6xK7G7MX8OCzxtzlAQH9VKZDQaaUysanWu6o zvajWhrqHN4az6mW2+dkT0jIh3F3i+65Pq/F58Ns8RHPf6bAfuTPX/99AZcn4n9sF25i tUSA== X-Gm-Message-State: AOAM531+BMOXQU/kI6uk4Slc9Frs3iwPckOJmdZWgtWSyG7hQkjAr/0l LC1Z7oMOAHHuQzBmiaQSToK7xw== X-Received: by 2002:a17:902:db01:: with SMTP id m1mr8805397plx.53.1644515931043; Thu, 10 Feb 2022 09:58:51 -0800 (PST) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id y30sm3834969pfq.142.2022.02.10.09.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 09:58:49 -0800 (PST) Date: Thu, 10 Feb 2022 10:58:47 -0700 From: Mathieu Poirier To: Julia Lawall Cc: Wendy Liang , Michal Simek , Ohad Ben-Cohen , Bjorn Andersson , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, kbuild-all@lists.01.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] remoteproc: fix minmax.cocci warnings Message-ID: <20220210175847.GA3603040@p14s> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi, On Tue, Feb 08, 2022 at 09:41:39PM +0100, Julia Lawall wrote: > From: kernel test robot > > The code seems more readable with min. > > Generated by: scripts/coccinelle/misc/minmax.cocci > > Fixes: 2b9408d09dc6 ("remoteproc: Add support for peek from remote and acking kick from remote") > CC: Wendy Liang > Reported-by: kernel test robot > Signed-off-by: kernel test robot > Signed-off-by: Julia Lawall > > --- > > tree: https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15 > head: 1183ce490adb103e5e569b8ebd74c50c885ddc05 > commit: 2b9408d09dc6367fd2f0820f0c7beab69e9aed56 [550/872] remoteproc: Add support for peek from remote and acking kick from remote > :::::: branch date: 7 days ago > :::::: commit date: 7 days ago > > remoteproc_sysfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- a/drivers/remoteproc/remoteproc_sysfs.c > +++ b/drivers/remoteproc/remoteproc_sysfs.c > @@ -241,7 +241,7 @@ static ssize_t kick_store(struct device > size_t cpy_len; > > (void)attr; > - cpy_len = count <= sizeof(id) ? count : sizeof(id); > + cpy_len = min(count, sizeof(id)); Looking at the min() macro the above would become "count < sizeof(id)" rather than "count <= sizeof(id)". I don't have more context into this code because I can't find it in rproc-next nor today's linux-next, but it is something to look into. The patch is also missing the minmax.h include for the min() macro. Thanks, Mathieu > memcpy((char *)(&id), buf, cpy_len); > > if (rproc->ops->kick)