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 D06A3C433FE for ; Thu, 10 Feb 2022 17:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245439AbiBJR6w (ORCPT ); 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-Google-Smtp-Source: ABdhPJybX2DTRur/fqp1T3fsi1sv7jdOfBkzRKrTiFCl1wtzaexEErRObkoG10fCF7lKUo/ZB94mrw== 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: 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)