diff --git a/sys/compat/linuxkpi/common/include/linux/overflow.h b/sys/compat/linuxkpi/common/include/linux/overflow.h index 593aa8cb2718..6f53f0b59384 100644 --- a/sys/compat/linuxkpi/common/include/linux/overflow.h +++ b/sys/compat/linuxkpi/common/include/linux/overflow.h @@ -31,6 +31,9 @@ #ifndef __LINUX_OVERFLOW_H__ #define __LINUX_OVERFLOW_H__ +#include +#include + #ifndef __has_builtin #define __has_builtin(x) 0 #endif @@ -45,6 +48,16 @@ #if __has_builtin(__builtin_mul_overflow) #define check_mul_overflow(a, b, c) \ __builtin_mul_overflow(a, b, c) + +static inline size_t +array_size(size_t x, size_t y) +{ + size_t retval; + + if (__builtin_mul_overflow(x, y, &retval)) + retval = SIZE_MAX; + return (retval); +} #else #error "Compiler does not support __builtin_mul_overflow" #endif diff --git a/sys/sys/param.h b/sys/sys/param.h index 3823facbca62..25b9aedaa81c 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300100 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300101 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,