Skip to contentSkip to conversation

overflow: Include header file with SIZE_MAX declaration

PATCH Applied Leon Romanovsky 2 participants 2 messages Sep 13, 2020 – Oct 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 overflow: Include header file with SIZE_MAX declaration

From: Leon Romanovsky <[email protected]>

The various array_size functions use SIZE_MAX define, but missed limits.h causes to failure to compile code that needs overflow.h.

In file included from drivers/infiniband/core/uverbs_std_types_device.c:6:
./include/linux/overflow.h: In function 'array_size':
./include/linux/overflow.h:258:10: error: 'SIZE_MAX' undeclared (first use in this function)

   258 |   return SIZE_MAX;
       |          ^~~~~~~~
Fixes 610b15c50e86 ("overflow.h: Add allocation size calculation helpers")
---
 include/linux/overflow.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/overflow.h +1 -0
index 93fcef105061..ff3c48f0abc5 100644
@@ -3,6 +3,7 @@
 #define __LINUX_OVERFLOW_H
 
 #include <linux/compiler.h>
+#include <linux/limits.h>
 
 /*
  * In the fallback code below, we need to compute the minimum and

--
2.26.2

maintainer Applied
#1 lore raw
Quoted 8 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

The various array_size functions use SIZE_MAX define, but missed limits.h causes to failure to compile code that needs overflow.h.

In file included from drivers/infiniband/core/uverbs_std_types_device.c:6:
./include/linux/overflow.h: In function 'array_size':
./include/linux/overflow.h:258:10: error: 'SIZE_MAX' undeclared (first use in this function)

Quoted 8 lines
   258 |   return SIZE_MAX;
       |          ^~~~~~~~
Fixes 610b15c50e86 ("overflow.h: Add allocation size calculation helpers")
---
 include/linux/overflow.h | 1 +
 1 file changed, 1 insertion(+)

Applied to rdma for-next, seems other patches need this. Thanks

Jason