summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-16 20:29:00 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-16 20:29:00 +0300
commitb2ca74d32bba153a1507e6b7e36d3ec8a89311a1 (patch)
tree7efc712ce6453a2a9a231bdaf858fbedd35a0c03 /include
parent8c05f3b965da14e7790711026b32cc10a4c06213 (diff)
parent2decec48b0fd28ffdbf4cc684bd04e735f0839dd (diff)
downloadlinux-b2ca74d32bba153a1507e6b7e36d3ec8a89311a1.tar.xz
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core fixes from Ingo Molnar: "A handful of objtool updates, plus a documentation addition for __ab_c_size()" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Fix whitelist documentation typo objtool: Fix function fallthrough detection objtool: Don't use ignore flag for fake jumps overflow.h: Add comment documenting __ab_c_size()
Diffstat (limited to 'include')
-rw-r--r--include/linux/overflow.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index 15eb85de9226..659045046468 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -284,11 +284,15 @@ static inline __must_check size_t array3_size(size_t a, size_t b, size_t c)
return bytes;
}
-static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
+/*
+ * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for
+ * struct_size() below.
+ */
+static inline __must_check size_t __ab_c_size(size_t a, size_t b, size_t c)
{
size_t bytes;
- if (check_mul_overflow(n, size, &bytes))
+ if (check_mul_overflow(a, b, &bytes))
return SIZE_MAX;
if (check_add_overflow(bytes, c, &bytes))
return SIZE_MAX;