Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Dec 2019 00:49:49 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r356193 - stable/12/sys/sys
Message-ID:  <201912300049.xBU0nnCV035494@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Dec 30 00:49:49 2019
New Revision: 356193
URL: https://svnweb.freebsd.org/changeset/base/356193

Log:
  MFC r356039:
  Fix undefined behavior: left-shifting into the sign bit.

Modified:
  stable/12/sys/sys/_sigset.h
  stable/12/sys/sys/bitset.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/sys/_sigset.h
==============================================================================
--- stable/12/sys/sys/_sigset.h	Mon Dec 30 00:46:10 2019	(r356192)
+++ stable/12/sys/sys/_sigset.h	Mon Dec 30 00:49:49 2019	(r356193)
@@ -47,7 +47,7 @@
 #define	_SIG_MAXSIG	128
 #define	_SIG_IDX(sig)	((sig) - 1)
 #define	_SIG_WORD(sig)	(_SIG_IDX(sig) >> 5)
-#define	_SIG_BIT(sig)	(1 << (_SIG_IDX(sig) & 31))
+#define	_SIG_BIT(sig)	(1U << (_SIG_IDX(sig) & 31))
 #define	_SIG_VALID(sig)	((sig) <= _SIG_MAXSIG && (sig) > 0)
 
 typedef struct __sigset {

Modified: stable/12/sys/sys/bitset.h
==============================================================================
--- stable/12/sys/sys/bitset.h	Mon Dec 30 00:46:10 2019	(r356192)
+++ stable/12/sys/sys/bitset.h	Mon Dec 30 00:49:49 2019	(r356193)
@@ -35,7 +35,7 @@
 #define	_SYS_BITSET_H_
 
 #define	__bitset_mask(_s, n)						\
-	(1L << ((__bitset_words((_s)) == 1) ?				\
+	(1UL << ((__bitset_words((_s)) == 1) ?				\
 	    (__size_t)(n) : ((n) % _BITSET_BITS)))
 
 #define	__bitset_word(_s, n)						\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912300049.xBU0nnCV035494>