[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25b5f2297c98500ed91971a61ccc4bfa5921035e.camel@redhat.com>
Date: Thu, 28 Mar 2024 16:21:38 +0100
From: Philipp Stanner <pstanner@...hat.com>
To: Arnd Bergmann <arnd@...nel.org>, linux-kernel@...r.kernel.org, Ryusuke
Konishi <konishi.ryusuke@...il.com>, Nathan Chancellor <nathan@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>, Nick Desaulniers
<ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>, Justin Stitt
<justinstitt@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>,
Christian Brauner <brauner@...nel.org>, Jeff Layton <jlayton@...nel.org>,
Thorsten Blum <thorsten.blum@...lux.com>, linux-nilfs@...r.kernel.org,
llvm@...ts.linux.dev, pstanner@...hat.com
Subject: Re: [PATCH 6/9] nilfs2: fix out-of-range warning
On Thu, 2024-03-28 at 15:30 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> clang-14 points out that v_size is always smaller than a 64KB
> page size if that is configured by the CPU architecture:
>
> fs/nilfs2/ioctl.c:63:19: error: result of comparison of constant
> 65536 with expression of type '__u16' (aka 'unsigned short') is
> always false [-Werror,-Wtautological-constant-out-of-range-compare]
> if (argv->v_size > PAGE_SIZE)
> ~~~~~~~~~~~~ ^ ~~~~~~~~~
>
> This is ok, so just shut up that warning with a cast.
nit:
It's not a warning, but actually a compile error, right?
(no idea why they make that an error btw. Warning would be perfectly
fine)
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Should / could that be backported to stable kernels in case people
start building those with clang-14?
Regards,
P.
> ---
> fs/nilfs2/ioctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
> index f1a01c191cf5..8be471ce4f19 100644
> --- a/fs/nilfs2/ioctl.c
> +++ b/fs/nilfs2/ioctl.c
> @@ -60,7 +60,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs
> *nilfs,
> if (argv->v_nmembs == 0)
> return 0;
>
> - if (argv->v_size > PAGE_SIZE)
> + if ((size_t)argv->v_size > PAGE_SIZE)
> return -EINVAL;
>
> /*
Powered by blists - more mailing lists