linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Wendy Liang <wendy.liang@xilinx.com>,
	Michal Simek <monstr@monstr.eu>, Ohad Ben-Cohen <ohad@wizery.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	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
Date: Thu, 10 Feb 2022 10:58:47 -0700	[thread overview]
Message-ID: <20220210175847.GA3603040@p14s> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2202082139180.52266@hadrien>

Hi,

On Tue, Feb 08, 2022 at 09:41:39PM +0100, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> 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 <wendy.liang@xilinx.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> 
> ---
> 
> 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)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2022-02-10 18:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 20:41 [PATCH] remoteproc: fix minmax.cocci warnings Julia Lawall
2022-02-10 17:58 ` Mathieu Poirier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220210175847.GA3603040@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=julia.lawall@inria.fr \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=monstr@monstr.eu \
    --cc=ohad@wizery.com \
    --cc=wendy.liang@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).