summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-12-05 13:35:11 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-12 12:21:17 +0100
commit17a7f9d865304997e8bc25eae3e915e83e70e3fa (patch)
treebe17ec0ab62cb01ec7bec93196629cdfbc5babd7
parent324172d2adcce8d2b927c0d667ca4da6f88bbb92 (diff)
downloadlinux-stable-17a7f9d865304997e8bc25eae3e915e83e70e3fa.tar.gz
linux-stable-17a7f9d865304997e8bc25eae3e915e83e70e3fa.tar.bz2
linux-stable-17a7f9d865304997e8bc25eae3e915e83e70e3fa.zip
netfilter: uapi: Avoid undefined left-shift in xt_sctp.h
[ Upstream commit 164166558aacea01b99c8c8ffb710d930405ba69 ] With 'bytes(__u32)' being 32, a left-shift of 31 may happen which is undefined for the signed 32-bit value 1. Avoid this by declaring 1 as unsigned. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--include/uapi/linux/netfilter/xt_sctp.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/uapi/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h
index 4bc6d1a08781..b4d804a9fccb 100644
--- a/include/uapi/linux/netfilter/xt_sctp.h
+++ b/include/uapi/linux/netfilter/xt_sctp.h
@@ -41,19 +41,19 @@ struct xt_sctp_info {
#define SCTP_CHUNKMAP_SET(chunkmap, type) \
do { \
(chunkmap)[type / bytes(__u32)] |= \
- 1 << (type % bytes(__u32)); \
+ 1u << (type % bytes(__u32)); \
} while (0)
#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
do { \
(chunkmap)[type / bytes(__u32)] &= \
- ~(1 << (type % bytes(__u32))); \
+ ~(1u << (type % bytes(__u32))); \
} while (0)
#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
({ \
((chunkmap)[type / bytes (__u32)] & \
- (1 << (type % bytes (__u32)))) ? 1: 0; \
+ (1u << (type % bytes (__u32)))) ? 1: 0; \
})
#define SCTP_CHUNKMAP_RESET(chunkmap) \