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)                                            
\
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to