linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Berg <benjamin@sipsolutions.net>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>, richard@nod.at
Cc: anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net,
	 linux-um@lists.infradead.org, linux-kernel@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH -next] um: Use ARRAY_SIZE for array length
Date: Thu, 07 Aug 2025 07:08:58 +0200	[thread overview]
Message-ID: <69f40a6f907deb7225cb6c1c8f59926d98a580b2.camel@sipsolutions.net> (raw)
In-Reply-To: <20250807023227.2443863-1-jiapeng.chong@linux.alibaba.com>

Hi,

there is a good reason for this. The bug is a false positive as the
relevant include is not (and cannot be) used in the file. This patch
does not even compile.

Benjamin

On Thu, 2025-08-07 at 10:32 +0800, Jiapeng Chong wrote:
> Use of macro ARRAY_SIZE to calculate array size minimizes
> the redundant code and improves code reusability.
> 
> ./arch/um/kernel/skas/stub_exe.c:196:23-24: WARNING: Use ARRAY_SIZE.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=23410
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  arch/um/kernel/skas/stub_exe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/um/kernel/skas/stub_exe.c
> b/arch/um/kernel/skas/stub_exe.c
> index cbafaa684e66..01a938a5bb4f 100644
> --- a/arch/um/kernel/skas/stub_exe.c
> +++ b/arch/um/kernel/skas/stub_exe.c
> @@ -193,7 +193,7 @@ noinline static void real_init(void)
>  			BPF_STMT(BPF_RET | BPF_K,
> SECCOMP_RET_ALLOW),
>  		};
>  		struct sock_fprog prog = {
> -			.len = sizeof(filter) / sizeof(filter[0]),
> +			.len = ARRAY_SIZE(filter),
>  			.filter = filter,
>  		};
>  


  reply	other threads:[~2025-08-07  5:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07  2:32 [PATCH -next] um: Use ARRAY_SIZE for array length Jiapeng Chong
2025-08-07  5:08 ` Benjamin Berg [this message]
2025-08-07 14:44 ` kernel test robot

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=69f40a6f907deb7225cb6c1c8f59926d98a580b2.camel@sipsolutions.net \
    --to=benjamin@sipsolutions.net \
    --cc=abaci@linux.alibaba.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /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).