2021-05-13 05:05:21

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH] thread_info.h: include limits.h for INT_MAX

Add header file <linux/limits.h> to make thread_info.h be
self-contained.
Fixes multiple occurrences of this error:

../include/linux/thread_info.h: In function ‘check_copy_size’:
../include/linux/thread_info.h:215:27: error: ‘INT_MAX’ undeclared (first use in this function)
if (WARN_ON_ONCE(bytes > INT_MAX))
^

Fixes: 6d13de1489b6 ("uaccess: disallow > INT_MAX copy sizes")
Signed-off-by: Randy Dunlap <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Andrew Morton <[email protected]>
---
include/linux/thread_info.h | 1 +
1 file changed, 1 insertion(+)

--- mmotm-2021-0512-2146.orig/include/linux/thread_info.h
+++ mmotm-2021-0512-2146/include/linux/thread_info.h
@@ -10,6 +10,7 @@

#include <linux/types.h>
#include <linux/bug.h>
+#include <linux/limits.h>
#include <linux/restart_block.h>
#include <linux/errno.h>