Files
media_build/backports/v5.17_overflow.patch
Hans Verkuil 4e29721804 Add v5.17_overflow.patch
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-04-05 08:22:11 +02:00

35 lines
1.4 KiB
Diff

diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index f1221d11f8e5..59d7228104d0 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -4,7 +4,6 @@
#include <linux/compiler.h>
#include <linux/limits.h>
-#include <linux/const.h>
/*
* We need to compute the minimum and maximum values representable in a given
@@ -222,9 +221,8 @@ static inline size_t __must_check size_sub(size_t minuend, size_t subtrahend)
* Return: number of bytes needed or SIZE_MAX on overflow.
*/
#define flex_array_size(p, member, count) \
- __builtin_choose_expr(__is_constexpr(count), \
- (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
- size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
+ size_mul(count, \
+ sizeof(*(p)->member) + __must_be_array((p)->member))
/**
* struct_size() - Calculate size of structure with trailing flexible array.
@@ -239,8 +237,6 @@ static inline size_t __must_check size_sub(size_t minuend, size_t subtrahend)
* Return: number of bytes needed or SIZE_MAX on overflow.
*/
#define struct_size(p, member, count) \
- __builtin_choose_expr(__is_constexpr(count), \
- sizeof(*(p)) + flex_array_size(p, member, count), \
- size_add(sizeof(*(p)), flex_array_size(p, member, count)))
+ size_add(sizeof(*(p)), flex_array_size(p, member, count))
#endif /* __LINUX_OVERFLOW_H */