All of lore.kernel.org
 help / color / mirror / Atom feed
* [iptables PATCH] include: Avoid undefined left-shift in xt_sctp.h
@ 2020-05-29 18:10 Phil Sutter
  2020-05-29 18:26 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2020-05-29 18:10 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

Pull the fix in kernel commit 164166558aace ("netfilter: uapi: Avoid
undefined left-shift in xt_sctp.h") into iptables repository. The
original description is:

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>
---
 include/linux/netfilter/xt_sctp.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index a501e6196905d..5b28525a2482a 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -40,19 +40,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) \
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [iptables PATCH] include: Avoid undefined left-shift in xt_sctp.h
  2020-05-29 18:10 [iptables PATCH] include: Avoid undefined left-shift in xt_sctp.h Phil Sutter
@ 2020-05-29 18:26 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-05-29 18:26 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel

On Fri, May 29, 2020 at 08:10:22PM +0200, Phil Sutter wrote:
> Pull the fix in kernel commit 164166558aace ("netfilter: uapi: Avoid
> undefined left-shift in xt_sctp.h") into iptables repository. The
> original description is:
> 
> 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>

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>

Thanks Phil.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-29 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 18:10 [iptables PATCH] include: Avoid undefined left-shift in xt_sctp.h Phil Sutter
2020-05-29 18:26 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.