linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] kbuild: remove gcc's -Wtype-limits
@ 2025-12-20 11:02 Vincent Mailhol
  2025-12-20 11:02 ` [PATCH v3 1/3] " Vincent Mailhol
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Vincent Mailhol @ 2025-12-20 11:02 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason,
	David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

I often read on the mailing list people saying "who cares about W=2
builds anyway?". At least I do. Not that I want to fix all of them,
but on some occasions, such as new driver submissions, I have often
found a couple valid diagnostics in the W=2 output.

That said, the annoying thing is that W=2 is heavily polluted by one
warning: -Wtype-limits. Try a gcc W=2 build on any file and see the
results for yourself. I suspect this to be the reason why so few
people are using W=2.

This series removes gcc's -Wtype-limits in an attempt to make W=2 more
useful. Those who do not use W=2 can continue to not use it if they
want. Those who, like me, use it for time to time will get an improved
experience from the reduced spam.

Patch #1 deactivates -Wtype-limits.  Extra details on statistics, past
attempts and alternatives are given in the description.

Patch #2 clean-ups the local kbuild -Wno-type-limits exceptions, while
patch #3 undoes a local workaround which silenced that warning by
uglifying the code.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
Changes in v3:

  - Remove patch #4.

Link to v2: https://lore.kernel.org/r/20251219-remove_wtype-limits-v2-0-2e92b3f566c5@kernel.org

Changes in v2:

  - Add two more patches to clean up some -Wtype-limits workarounds
  - Collect the Reviewed-by tags.

Link to v1: https://lore.kernel.org/r/20251218-remove_wtype-limits-v1-0-735417536787@kernel.org

---
Vincent Mailhol (3):
      kbuild: remove gcc's -Wtype-limits
      kbuild: cleanup local -Wno-type-limits exceptions
      overflow: Remove is_non_negative() and is_negative()

 drivers/gpu/drm/Makefile |  1 -
 fs/btrfs/Makefile        |  1 -
 include/linux/overflow.h | 10 ++--------
 scripts/Makefile.warn    |  4 +++-
 4 files changed, 5 insertions(+), 11 deletions(-)
---
base-commit: 3e7f562e20ee87a25e104ef4fce557d39d62fa85
change-id: 20251205-remove_wtype-limits-c77eb46d09c2

Best regards,
-- 
Vincent Mailhol <mailhol@kernel.org>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3 1/3] kbuild: remove gcc's -Wtype-limits
  2025-12-20 11:02 [PATCH v3 0/3] kbuild: remove gcc's -Wtype-limits Vincent Mailhol
@ 2025-12-20 11:02 ` Vincent Mailhol
  2025-12-20 11:02 ` [PATCH v3 2/3] kbuild: cleanup local -Wno-type-limits exceptions Vincent Mailhol
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
  2 siblings, 0 replies; 12+ messages in thread
From: Vincent Mailhol @ 2025-12-20 11:02 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason,
	David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

W=2 builds are heavily polluted by the -Wtype-limits warning.

Here are some W=12 statistics on Linux v6.19-rc1 for an x86_64
defconfig (with just CONFIG_WERROR set to "n") using gcc 14.3.1:

	 Warning name			count	percent
	-------------------------------------------------
	 -Wlogical-op			    2	  0.00 %
	 -Wmaybe-uninitialized		  138	  0.20 %
	 -Wunused-macros		  869	  1.24 %
	 -Wmissing-field-initializers	 1418	  2.02 %
	 -Wshadow			 2234	  3.19 %
	 -Wtype-limits			65378	 93.35 %
	-------------------------------------------------
	 Total				70039	100.00 %

As we can see, -Wtype-limits represents the vast majority of all
warnings. The reason behind this is that these warnings appear in
some common header files, meaning that some unique warnings are
repeated tens of thousands of times (once per header inclusion).

Add to this the fact that each warning is coupled with a dozen lines
detailing some macro expansion. The end result is that the W=2 output
is just too bloated and painful to use.

Three years ago, I proposed in [1] modifying one such header to
silence that noise. Because the code was not faulty, Linus rejected
the idea and instead suggested simply removing that warning.

At that time, I could not bring myself to send such a patch because,
despite its problems, -Wtype-limits would still catch the below bug:

	unsigned int ret;

	ret = check();
	if (ret < 0)
		error();

Meanwhile, based on another suggestion from Linus, I added a new check
to sparse [2] that would catch the above bug without the useless spam.

With this, remove gcc's -Wtype-limits. People who still want to catch
incorrect comparisons between unsigned integers and zero can now use
sparse instead.

On a side note, clang also has a -Wtype-limits warning but:

  * it is not enabled in the kernel at the moment because, contrary to
    gcc, clang did not include it under -Wextra.

  * it does not warn if the code results from a macro expansion. So,
    if activated, it would not cause as much spam as gcc does.

  * -Wtype-limits is split into four sub-warnings [3] meaning that if
    it were to be activated, we could select which one to keep.

So there is no present need to explicitly disable -Wtype-limits in
clang.

[1] linux/bits.h: GENMASK_INPUT_CHECK: reduce W=2 noise by 31% treewide
Link: https://lore.kernel.org/all/20220308141201.2343757-1-mailhol.vincent@wanadoo.fr/

[2] Warn about "unsigned value that used to be signed against zero"
Link: https://lore.kernel.org/all/20250921061337.3047616-1-mailhol@kernel.org/

[3] clang's -Wtype-limits
Link: https://clang.llvm.org/docs/DiagnosticsReference.html#wtype-limits

Reviewed-by: Nicolas Schier <nsc@kernel.org>
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
 scripts/Makefile.warn | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.warn b/scripts/Makefile.warn
index 68e6fafcb80c..c593ab1257de 100644
--- a/scripts/Makefile.warn
+++ b/scripts/Makefile.warn
@@ -55,6 +55,9 @@ else
 KBUILD_CFLAGS += -Wno-main
 endif
 
+# Too noisy on range checks and in macros handling both signed and unsigned.
+KBUILD_CFLAGS += -Wno-type-limits
+
 # These result in bogus false positives
 KBUILD_CFLAGS += $(call cc-option, -Wno-dangling-pointer)
 
@@ -174,7 +177,6 @@ else
 
 # The following turn off the warnings enabled by -Wextra
 KBUILD_CFLAGS += -Wno-missing-field-initializers
-KBUILD_CFLAGS += -Wno-type-limits
 KBUILD_CFLAGS += -Wno-shift-negative-value
 
 ifdef CONFIG_CC_IS_CLANG

-- 
2.51.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 2/3] kbuild: cleanup local -Wno-type-limits exceptions
  2025-12-20 11:02 [PATCH v3 0/3] kbuild: remove gcc's -Wtype-limits Vincent Mailhol
  2025-12-20 11:02 ` [PATCH v3 1/3] " Vincent Mailhol
@ 2025-12-20 11:02 ` Vincent Mailhol
  2025-12-20 12:53   ` Nicolas Schier
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
  2 siblings, 1 reply; 12+ messages in thread
From: Vincent Mailhol @ 2025-12-20 11:02 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason,
	David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

Now that -Wtype-limits is globally deactivated, there is no need for
local exceptions anymore.

Acked-by: David Sterba <dsterba@suse.com>
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
Changelog:

  v1 -> v2: small change in patch description
---
 drivers/gpu/drm/Makefile | 1 -
 fs/btrfs/Makefile        | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 0e1c668b46d2..b879a60ca79a 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -22,7 +22,6 @@ subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
 # The following turn off the warnings enabled by -Wextra
 ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
 subdir-ccflags-y += -Wno-missing-field-initializers
-subdir-ccflags-y += -Wno-type-limits
 subdir-ccflags-y += -Wno-shift-negative-value
 endif
 ifeq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 743d7677b175..40bc2f7e6f6b 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -17,7 +17,6 @@ subdir-ccflags-y += $(condflags)
 # The following turn off the warnings enabled by -Wextra
 subdir-ccflags-y += -Wno-missing-field-initializers
 subdir-ccflags-y += -Wno-sign-compare
-subdir-ccflags-y += -Wno-type-limits
 subdir-ccflags-y += -Wno-shift-negative-value
 
 obj-$(CONFIG_BTRFS_FS) := btrfs.o

-- 
2.51.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-20 11:02 [PATCH v3 0/3] kbuild: remove gcc's -Wtype-limits Vincent Mailhol
  2025-12-20 11:02 ` [PATCH v3 1/3] " Vincent Mailhol
  2025-12-20 11:02 ` [PATCH v3 2/3] kbuild: cleanup local -Wno-type-limits exceptions Vincent Mailhol
@ 2025-12-20 11:02 ` Vincent Mailhol
  2025-12-20 12:52   ` Nicolas Schier
                     ` (5 more replies)
  2 siblings, 6 replies; 12+ messages in thread
From: Vincent Mailhol @ 2025-12-20 11:02 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Chris Mason,
	David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: Linus Torvalds, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

The is_non_negative() and is_negative() function-like macros just
exist as a workaround to silence the -Wtype-limits warning. Now that
this warning is disabled, those two macros have lost their raison
d'être. Remove them.

This reverts commit dc7fe518b049 ("overflow: Fix -Wtype-limits
compilation warnings").

Suggested-by: Nicolas Schier <nsc@kernel.org>
Link: https://lore.kernel.org/all/aUT_yWin_xslnOFh@derry.ads.avm.de
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
Changelog:

  v1 -> v2: new patch
---
 include/linux/overflow.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index 736f633b2d5f..ab142d60c6b5 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -36,12 +36,6 @@
 #define __type_min(T) ((T)((T)-type_max(T)-(T)1))
 #define type_min(t)	__type_min(typeof(t))
 
-/*
- * Avoids triggering -Wtype-limits compilation warning,
- * while using unsigned data types to check a < 0.
- */
-#define is_non_negative(a) ((a) > 0 || (a) == 0)
-#define is_negative(a) (!(is_non_negative(a)))
 
 /*
  * Allows for effectively applying __must_check to a macro so we can have
@@ -201,9 +195,9 @@ static inline bool __must_check __must_check_overflow(bool overflow)
 	typeof(d) _d = d;						\
 	unsigned long long _a_full = _a;				\
 	unsigned int _to_shift =					\
-		is_non_negative(_s) && _s < 8 * sizeof(*d) ? _s : 0;	\
+		_s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;		\
 	*_d = (_a_full << _to_shift);					\
-	(_to_shift != _s || is_negative(*_d) || is_negative(_a) ||	\
+	(_to_shift != _s || *_d < 0 || _a < 0 ||			\
 	(*_d >> _to_shift) != _a);					\
 }))
 

-- 
2.51.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
@ 2025-12-20 12:52   ` Nicolas Schier
  2025-12-22 10:03   ` kernel test robot
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Nicolas Schier @ 2025-12-20 12:52 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Chris Mason, David Sterba, Kees Cook,
	Gustavo A. R. Silva, Linus Torvalds, linux-kbuild, linux-sparse,
	linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening

On Sat, Dec 20, 2025 at 12:02:21PM +0100, Vincent Mailhol wrote:
> The is_non_negative() and is_negative() function-like macros just
> exist as a workaround to silence the -Wtype-limits warning. Now that
> this warning is disabled, those two macros have lost their raison
> d'être. Remove them.
> 
> This reverts commit dc7fe518b049 ("overflow: Fix -Wtype-limits
> compilation warnings").
> 
> Suggested-by: Nicolas Schier <nsc@kernel.org>
> Link: https://lore.kernel.org/all/aUT_yWin_xslnOFh@derry.ads.avm.de
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
> ---
> Changelog:
> 
>   v1 -> v2: new patch
> ---
>  include/linux/overflow.h | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 

Thanks!

Reviewed-by: Nicolas Schier <nsc@kernel.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 2/3] kbuild: cleanup local -Wno-type-limits exceptions
  2025-12-20 11:02 ` [PATCH v3 2/3] kbuild: cleanup local -Wno-type-limits exceptions Vincent Mailhol
@ 2025-12-20 12:53   ` Nicolas Schier
  0 siblings, 0 replies; 12+ messages in thread
From: Nicolas Schier @ 2025-12-20 12:53 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Chris Mason, David Sterba, Kees Cook,
	Gustavo A. R. Silva, Linus Torvalds, linux-kbuild, linux-sparse,
	linux-kernel, llvm, dri-devel, linux-btrfs, linux-hardening

On Sat, Dec 20, 2025 at 12:02:20PM +0100, Vincent Mailhol wrote:
> Now that -Wtype-limits is globally deactivated, there is no need for
> local exceptions anymore.
> 
> Acked-by: David Sterba <dsterba@suse.com>
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
> ---
> Changelog:
> 
>   v1 -> v2: small change in patch description
> ---
>  drivers/gpu/drm/Makefile | 1 -
>  fs/btrfs/Makefile        | 1 -
>  2 files changed, 2 deletions(-)
> 

Reviewed-by: Nicolas Schier <nsc@kernel.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
  2025-12-20 12:52   ` Nicolas Schier
@ 2025-12-22 10:03   ` kernel test robot
  2025-12-22 18:39     ` Vincent Mailhol
  2025-12-22 19:55   ` kernel test robot
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2025-12-22 10:03 UTC (permalink / raw)
  To: Vincent Mailhol, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: oe-kbuild-all, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

Hi Vincent,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-190509
base:   3e7f562e20ee87a25e104ef4fce557d39d62fa85
patch link:    https://lore.kernel.org/r/20251220-remove_wtype-limits-v3-3-24b170af700e%40kernel.org
patch subject: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
config: x86_64-randconfig-161-20251222 (https://download.01.org/0day-ci/archive/20251222/202512221735.mRV4BZqB-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512221735.mRV4BZqB-lkp@intel.com/

smatch warnings:
fs/libfs.c:1628 generic_check_addressable() warn: unsigned '*_d' is never less than zero.
fs/libfs.c:1628 generic_check_addressable() warn: unsigned '_a' is never less than zero.
mm/vmalloc.c:4708 remap_vmalloc_range_partial() warn: unsigned '*_d' is never less than zero.
mm/vmalloc.c:4708 remap_vmalloc_range_partial() warn: unsigned '_a' is never less than zero.

vim +1628 fs/libfs.c

1b061d9247f71c Christoph Hellwig   2010-05-26  1613  
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1614  /**
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1615   * generic_check_addressable - Check addressability of file system
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1616   * @blocksize_bits:	log of file system block size
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1617   * @num_blocks:		number of blocks in file system
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1618   *
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1619   * Determine whether a file system with @num_blocks blocks (and a
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1620   * block size of 2**@blocksize_bits) is addressable by the sector_t
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1621   * and page cache of the system.  Return 0 if so and -EFBIG otherwise.
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1622   */
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1623  int generic_check_addressable(unsigned blocksize_bits, u64 num_blocks)
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1624  {
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1625  	u64 last_fs_block = num_blocks - 1;
25050181b61aa0 Pankaj Raghav       2025-06-30  1626  	u64 last_fs_page, max_bytes;
25050181b61aa0 Pankaj Raghav       2025-06-30  1627  
25050181b61aa0 Pankaj Raghav       2025-06-30 @1628  	if (check_shl_overflow(num_blocks, blocksize_bits, &max_bytes))
25050181b61aa0 Pankaj Raghav       2025-06-30  1629  		return -EFBIG;
25050181b61aa0 Pankaj Raghav       2025-06-30  1630  
25050181b61aa0 Pankaj Raghav       2025-06-30  1631  	last_fs_page = (max_bytes >> PAGE_SHIFT) - 1;
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1632  
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1633  	if (unlikely(num_blocks == 0))
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1634  		return 0;
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1635  
25050181b61aa0 Pankaj Raghav       2025-06-30  1636  	if (blocksize_bits < 9)
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1637  		return -EINVAL;
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1638  
a33f13efe05192 Joel Becker         2010-08-16  1639  	if ((last_fs_block > (sector_t)(~0ULL) >> (blocksize_bits - 9)) ||
a33f13efe05192 Joel Becker         2010-08-16  1640  	    (last_fs_page > (pgoff_t)(~0ULL))) {
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1641  		return -EFBIG;
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1642  	}
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1643  	return 0;
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1644  }
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1645  EXPORT_SYMBOL(generic_check_addressable);
30ca22c70e3ef0 Patrick J. LoPresti 2010-07-22  1646  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-22 10:03   ` kernel test robot
@ 2025-12-22 18:39     ` Vincent Mailhol
  0 siblings, 0 replies; 12+ messages in thread
From: Vincent Mailhol @ 2025-12-22 18:39 UTC (permalink / raw)
  To: kernel test robot, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: oe-kbuild-all, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening

On 22/12/2025 at 11:03, kernel test robot wrote:
> Hi Vincent,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-190509
> base:   3e7f562e20ee87a25e104ef4fce557d39d62fa85
> patch link:    https://lore.kernel.org/r/20251220-remove_wtype-limits-v3-3-24b170af700e%40kernel.org
> patch subject: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
> config: x86_64-randconfig-161-20251222 (https://download.01.org/0day-ci/archive/20251222/202512221735.mRV4BZqB-lkp@intel.com/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202512221735.mRV4BZqB-lkp@intel.com/
> 
> smatch warnings:
> fs/libfs.c:1628 generic_check_addressable() warn: unsigned '*_d' is never less than zero.
> fs/libfs.c:1628 generic_check_addressable() warn: unsigned '_a' is never less than zero.
> mm/vmalloc.c:4708 remap_vmalloc_range_partial() warn: unsigned '*_d' is never less than zero.
> mm/vmalloc.c:4708 remap_vmalloc_range_partial() warn: unsigned '_a' is never less than zero.

So smatch is not able to distinguish when the comparison comes from
a macro expansion.

Can this warning be ignored? Or should I remove this 3rd patch from
the series (and go back to v1)?  My choice would be to ignore this
warning.


Yours sincerely,
Vincent Mailhol

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
  2025-12-20 12:52   ` Nicolas Schier
  2025-12-22 10:03   ` kernel test robot
@ 2025-12-22 19:55   ` kernel test robot
  2025-12-25  6:04   ` kernel test robot
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2025-12-22 19:55 UTC (permalink / raw)
  To: Vincent Mailhol, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: oe-kbuild-all, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

Hi Vincent,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-190509
base:   3e7f562e20ee87a25e104ef4fce557d39d62fa85
patch link:    https://lore.kernel.org/r/20251220-remove_wtype-limits-v3-3-24b170af700e%40kernel.org
patch subject: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
config: i386-randconfig-141-20251222 (https://download.01.org/0day-ci/archive/20251223/202512230342.Lgha2HGH-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512230342.Lgha2HGH-lkp@intel.com/

New smatch warnings:
block/blk-settings.c:702 blk_stack_atomic_writes_chunk_sectors() warn: unsigned '*_d' is never less than zero.
block/blk-settings.c:702 blk_stack_atomic_writes_chunk_sectors() warn: unsigned '_a' is never less than zero.
drivers/nvme/host/core.c:3353 nvme_mps_to_sectors() warn: unsigned '*_d' is never less than zero.
drivers/nvme/host/core.c:3353 nvme_mps_to_sectors() warn: unsigned '_a' is never less than zero.

Old smatch warnings:
drivers/nvme/host/core.c:5032 nvme_free_cels() warn: iterator 'i' not incremented

vim +702 block/blk-settings.c

d7f36dc446e894 John Garry 2024-11-18  689  
63d092d1c1b1f7 John Garry 2025-07-11  690  static void blk_stack_atomic_writes_chunk_sectors(struct queue_limits *t)
d7f36dc446e894 John Garry 2024-11-18  691  {
63d092d1c1b1f7 John Garry 2025-07-11  692  	unsigned int chunk_bytes;
d7f36dc446e894 John Garry 2024-11-18  693  
63d092d1c1b1f7 John Garry 2025-07-11  694  	if (!t->chunk_sectors)
63d092d1c1b1f7 John Garry 2025-07-11  695  		return;
63d092d1c1b1f7 John Garry 2025-07-11  696  
63d092d1c1b1f7 John Garry 2025-07-11  697  	/*
63d092d1c1b1f7 John Garry 2025-07-11  698  	 * If chunk sectors is so large that its value in bytes overflows
63d092d1c1b1f7 John Garry 2025-07-11  699  	 * UINT_MAX, then just shift it down so it definitely will fit.
63d092d1c1b1f7 John Garry 2025-07-11  700  	 * We don't support atomic writes of such a large size anyway.
63d092d1c1b1f7 John Garry 2025-07-11  701  	 */
63d092d1c1b1f7 John Garry 2025-07-11 @702  	if (check_shl_overflow(t->chunk_sectors, SECTOR_SHIFT, &chunk_bytes))
63d092d1c1b1f7 John Garry 2025-07-11  703  		chunk_bytes = t->chunk_sectors;
d7f36dc446e894 John Garry 2024-11-18  704  
d7f36dc446e894 John Garry 2024-11-18  705  	/*
d7f36dc446e894 John Garry 2024-11-18  706  	 * Find values for limits which work for chunk size.
d7f36dc446e894 John Garry 2024-11-18  707  	 * b->atomic_write_hw_unit_{min, max} may not be aligned with chunk
63d092d1c1b1f7 John Garry 2025-07-11  708  	 * size, as the chunk size is not restricted to a power-of-2.
d7f36dc446e894 John Garry 2024-11-18  709  	 * So we need to find highest power-of-2 which works for the chunk
d7f36dc446e894 John Garry 2024-11-18  710  	 * size.
63d092d1c1b1f7 John Garry 2025-07-11  711  	 * As an example scenario, we could have t->unit_max = 16K and
63d092d1c1b1f7 John Garry 2025-07-11  712  	 * t->chunk_sectors = 24KB. For this case, reduce t->unit_max to a
63d092d1c1b1f7 John Garry 2025-07-11  713  	 * value aligned with both limits, i.e. 8K in this example.
d7f36dc446e894 John Garry 2024-11-18  714  	 */
63d092d1c1b1f7 John Garry 2025-07-11  715  	t->atomic_write_hw_unit_max = min(t->atomic_write_hw_unit_max,
63d092d1c1b1f7 John Garry 2025-07-11  716  					max_pow_of_two_factor(chunk_bytes));
d7f36dc446e894 John Garry 2024-11-18  717  
63d092d1c1b1f7 John Garry 2025-07-11  718  	t->atomic_write_hw_unit_min = min(t->atomic_write_hw_unit_min,
d7f36dc446e894 John Garry 2024-11-18  719  					  t->atomic_write_hw_unit_max);
63d092d1c1b1f7 John Garry 2025-07-11  720  	t->atomic_write_hw_max = min(t->atomic_write_hw_max, chunk_bytes);
63d092d1c1b1f7 John Garry 2025-07-11  721  }
d7f36dc446e894 John Garry 2024-11-18  722  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
                     ` (2 preceding siblings ...)
  2025-12-22 19:55   ` kernel test robot
@ 2025-12-25  6:04   ` kernel test robot
  2025-12-27  8:49   ` kernel test robot
  2025-12-28  1:41   ` kernel test robot
  5 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2025-12-25  6:04 UTC (permalink / raw)
  To: Vincent Mailhol, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: oe-kbuild-all, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

Hi Vincent,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-190509
base:   3e7f562e20ee87a25e104ef4fce557d39d62fa85
patch link:    https://lore.kernel.org/r/20251220-remove_wtype-limits-v3-3-24b170af700e%40kernel.org
patch subject: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
config: i386-randconfig-141-20251225 (https://download.01.org/0day-ci/archive/20251225/202512251340.UApIFw9R-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512251340.UApIFw9R-lkp@intel.com/

smatch warnings:
drivers/md/dm-stripe.c:463 stripe_io_hints() warn: unsigned '*_d' is never less than zero.
drivers/md/dm-stripe.c:463 stripe_io_hints() warn: unsigned '_a' is never less than zero.

vim +463 drivers/md/dm-stripe.c

af4874e03ed82f Mike Snitzer    2009-06-22  454  
40bea431274c24 Mike Snitzer    2009-09-04  455  static void stripe_io_hints(struct dm_target *ti,
40bea431274c24 Mike Snitzer    2009-09-04  456  			    struct queue_limits *limits)
40bea431274c24 Mike Snitzer    2009-09-04  457  {
40bea431274c24 Mike Snitzer    2009-09-04  458  	struct stripe_c *sc = ti->private;
1071d560afb4c2 Mikulas Patocka 2025-08-11  459  	unsigned int io_min, io_opt;
40bea431274c24 Mike Snitzer    2009-09-04  460  
5fb9d4341b782a John Garry      2025-07-11  461  	limits->chunk_sectors = sc->chunk_size;
1071d560afb4c2 Mikulas Patocka 2025-08-11  462  
1071d560afb4c2 Mikulas Patocka 2025-08-11 @463  	if (!check_shl_overflow(sc->chunk_size, SECTOR_SHIFT, &io_min) &&
1071d560afb4c2 Mikulas Patocka 2025-08-11  464  	    !check_mul_overflow(io_min, sc->stripes, &io_opt)) {
1071d560afb4c2 Mikulas Patocka 2025-08-11  465  		limits->io_min = io_min;
1071d560afb4c2 Mikulas Patocka 2025-08-11  466  		limits->io_opt = io_opt;
1071d560afb4c2 Mikulas Patocka 2025-08-11  467  	}
40bea431274c24 Mike Snitzer    2009-09-04  468  }
40bea431274c24 Mike Snitzer    2009-09-04  469  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
                     ` (3 preceding siblings ...)
  2025-12-25  6:04   ` kernel test robot
@ 2025-12-27  8:49   ` kernel test robot
  2025-12-28  1:41   ` kernel test robot
  5 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2025-12-27  8:49 UTC (permalink / raw)
  To: Vincent Mailhol, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: oe-kbuild-all, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

Hi Vincent,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-190509
base:   3e7f562e20ee87a25e104ef4fce557d39d62fa85
patch link:    https://lore.kernel.org/r/20251220-remove_wtype-limits-v3-3-24b170af700e%40kernel.org
patch subject: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
config: sparc-randconfig-r072-20251227 (https://download.01.org/0day-ci/archive/20251227/202512271618.33YepxDC-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 15.1.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512271618.33YepxDC-lkp@intel.com/

smatch warnings:
drivers/block/nbd.c:1612 __nbd_ioctl() warn: unsigned '_a' is never less than zero.

vim +/_a +1612 drivers/block/nbd.c

55313e92bd17a87 Mike Christie     2019-08-13  1591  
9442b739207aab6 Josef Bacik       2017-02-07  1592  /* Must be called with config_lock held */
9442b739207aab6 Josef Bacik       2017-02-07  1593  static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
9442b739207aab6 Josef Bacik       2017-02-07  1594  		       unsigned int cmd, unsigned long arg)
9442b739207aab6 Josef Bacik       2017-02-07  1595  {
5ea8d10802ec4c1 Josef Bacik       2017-04-06  1596  	struct nbd_config *config = nbd->config;
fad7cd3310db309 Baokun Li         2021-08-04  1597  	loff_t bytesize;
5ea8d10802ec4c1 Josef Bacik       2017-04-06  1598  
9442b739207aab6 Josef Bacik       2017-02-07  1599  	switch (cmd) {
9442b739207aab6 Josef Bacik       2017-02-07  1600  	case NBD_DISCONNECT:
29eaadc0364943b Josef Bacik       2017-04-06  1601  		return nbd_disconnect(nbd);
9442b739207aab6 Josef Bacik       2017-02-07  1602  	case NBD_CLEAR_SOCK:
0c1c9a27ce909e3 Christoph Hellwig 2023-08-11  1603  		nbd_clear_sock_ioctl(nbd);
29eaadc0364943b Josef Bacik       2017-04-06  1604  		return 0;
9442b739207aab6 Josef Bacik       2017-02-07  1605  	case NBD_SET_SOCK:
e46c7287b1c2768 Josef Bacik       2017-04-06  1606  		return nbd_add_socket(nbd, arg, false);
9442b739207aab6 Josef Bacik       2017-02-07  1607  	case NBD_SET_BLKSIZE:
dcbddf541f18e36 Christoph Hellwig 2020-11-16  1608  		return nbd_set_size(nbd, config->bytesize, arg);
9442b739207aab6 Josef Bacik       2017-02-07  1609  	case NBD_SET_SIZE:
41e76c6a3c83c85 Nick Desaulniers  2021-09-20  1610  		return nbd_set_size(nbd, arg, nbd_blksize(config));
9442b739207aab6 Josef Bacik       2017-02-07  1611  	case NBD_SET_SIZE_BLOCKS:
41e76c6a3c83c85 Nick Desaulniers  2021-09-20 @1612  		if (check_shl_overflow(arg, config->blksize_bits, &bytesize))
fad7cd3310db309 Baokun Li         2021-08-04  1613  			return -EINVAL;
41e76c6a3c83c85 Nick Desaulniers  2021-09-20  1614  		return nbd_set_size(nbd, bytesize, nbd_blksize(config));
9442b739207aab6 Josef Bacik       2017-02-07  1615  	case NBD_SET_TIMEOUT:
55313e92bd17a87 Mike Christie     2019-08-13  1616  		nbd_set_cmd_timeout(nbd, arg);
9442b739207aab6 Josef Bacik       2017-02-07  1617  		return 0;
9442b739207aab6 Josef Bacik       2017-02-07  1618  
9442b739207aab6 Josef Bacik       2017-02-07  1619  	case NBD_SET_FLAGS:
5ea8d10802ec4c1 Josef Bacik       2017-04-06  1620  		config->flags = arg;
9442b739207aab6 Josef Bacik       2017-02-07  1621  		return 0;
9442b739207aab6 Josef Bacik       2017-02-07  1622  	case NBD_DO_IT:
2a852a693f8839b Christoph Hellwig 2022-03-30  1623  		return nbd_start_device_ioctl(nbd);
^1da177e4c3f415 Linus Torvalds    2005-04-16  1624  	case NBD_CLEAR_QUE:
4b2f0260c74324a Herbert Xu        2006-01-06  1625  		/*
4b2f0260c74324a Herbert Xu        2006-01-06  1626  		 * This is for compatibility only.  The queue is always cleared
4b2f0260c74324a Herbert Xu        2006-01-06  1627  		 * by NBD_DO_IT or NBD_CLEAR_SOCK.
4b2f0260c74324a Herbert Xu        2006-01-06  1628  		 */
^1da177e4c3f415 Linus Torvalds    2005-04-16  1629  		return 0;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1630  	case NBD_PRINT_DEBUG:
fd8383fd88a2fd8 Josef Bacik       2016-09-08  1631  		/*
fd8383fd88a2fd8 Josef Bacik       2016-09-08  1632  		 * For compatibility only, we no longer keep a list of
fd8383fd88a2fd8 Josef Bacik       2016-09-08  1633  		 * outstanding requests.
fd8383fd88a2fd8 Josef Bacik       2016-09-08  1634  		 */
^1da177e4c3f415 Linus Torvalds    2005-04-16  1635  		return 0;
^1da177e4c3f415 Linus Torvalds    2005-04-16  1636  	}
1a2ad21128bb4eb Pavel Machek      2009-04-02  1637  	return -ENOTTY;
1a2ad21128bb4eb Pavel Machek      2009-04-02  1638  }
1a2ad21128bb4eb Pavel Machek      2009-04-02  1639  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
  2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
                     ` (4 preceding siblings ...)
  2025-12-27  8:49   ` kernel test robot
@ 2025-12-28  1:41   ` kernel test robot
  5 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2025-12-28  1:41 UTC (permalink / raw)
  To: Vincent Mailhol, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Chris Mason, David Sterba, Kees Cook, Gustavo A. R. Silva
  Cc: oe-kbuild-all, linux-kbuild, linux-sparse, linux-kernel, llvm,
	dri-devel, linux-btrfs, linux-hardening, Vincent Mailhol

Hi Vincent,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3e7f562e20ee87a25e104ef4fce557d39d62fa85]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincent-Mailhol/kbuild-remove-gcc-s-Wtype-limits/20251220-190509
base:   3e7f562e20ee87a25e104ef4fce557d39d62fa85
patch link:    https://lore.kernel.org/r/20251220-remove_wtype-limits-v3-3-24b170af700e%40kernel.org
patch subject: [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative()
config: arm-randconfig-r071-20251224 (https://download.01.org/0day-ci/archive/20251228/202512280906.wt7UNpya-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512280906.wt7UNpya-lkp@intel.com/

smatch warnings:
fs/xfs/xfs_mount.c:144 xfs_sb_validate_fsb_count() warn: unsigned '*_d' is never less than zero.
fs/xfs/xfs_mount.c:144 xfs_sb_validate_fsb_count() warn: unsigned '_a' is never less than zero.

vim +144 fs/xfs/xfs_mount.c

27174203f570b9 Christoph Hellwig 2009-03-30  130  
4cc929ee305c69 Nathan Scott      2007-05-14  131  /*
4cc929ee305c69 Nathan Scott      2007-05-14  132   * Check size of device based on the (data/realtime) block count.
4cc929ee305c69 Nathan Scott      2007-05-14  133   * Note: this check is used by the growfs code as well as mount.
4cc929ee305c69 Nathan Scott      2007-05-14  134   */
4cc929ee305c69 Nathan Scott      2007-05-14  135  int
4cc929ee305c69 Nathan Scott      2007-05-14  136  xfs_sb_validate_fsb_count(
4cc929ee305c69 Nathan Scott      2007-05-14  137  	xfs_sb_t	*sbp,
c8ce540db5f67d Darrick J. Wong   2017-06-16  138  	uint64_t	nblocks)
4cc929ee305c69 Nathan Scott      2007-05-14  139  {
cebf9dacd5c3ce Pankaj Raghav     2024-08-22  140  	uint64_t		max_bytes;
cebf9dacd5c3ce Pankaj Raghav     2024-08-22  141  
4cc929ee305c69 Nathan Scott      2007-05-14  142  	ASSERT(sbp->sb_blocklog >= BBSHIFT);
4cc929ee305c69 Nathan Scott      2007-05-14  143  
cebf9dacd5c3ce Pankaj Raghav     2024-08-22 @144  	if (check_shl_overflow(nblocks, sbp->sb_blocklog, &max_bytes))
cebf9dacd5c3ce Pankaj Raghav     2024-08-22  145  		return -EFBIG;
cebf9dacd5c3ce Pankaj Raghav     2024-08-22  146  
d5cf09baced0ef Christoph Hellwig 2014-07-30  147  	/* Limited by ULONG_MAX of page cache index */
cebf9dacd5c3ce Pankaj Raghav     2024-08-22  148  	if (max_bytes >> PAGE_SHIFT > ULONG_MAX)
2451337dd04390 Dave Chinner      2014-06-25  149  		return -EFBIG;
4cc929ee305c69 Nathan Scott      2007-05-14  150  	return 0;
4cc929ee305c69 Nathan Scott      2007-05-14  151  }
^1da177e4c3f41 Linus Torvalds    2005-04-16  152  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-12-28  1:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-20 11:02 [PATCH v3 0/3] kbuild: remove gcc's -Wtype-limits Vincent Mailhol
2025-12-20 11:02 ` [PATCH v3 1/3] " Vincent Mailhol
2025-12-20 11:02 ` [PATCH v3 2/3] kbuild: cleanup local -Wno-type-limits exceptions Vincent Mailhol
2025-12-20 12:53   ` Nicolas Schier
2025-12-20 11:02 ` [PATCH v3 3/3] overflow: Remove is_non_negative() and is_negative() Vincent Mailhol
2025-12-20 12:52   ` Nicolas Schier
2025-12-22 10:03   ` kernel test robot
2025-12-22 18:39     ` Vincent Mailhol
2025-12-22 19:55   ` kernel test robot
2025-12-25  6:04   ` kernel test robot
2025-12-27  8:49   ` kernel test robot
2025-12-28  1:41   ` kernel test robot

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).