Date: Mon, 23 Dec 2019 20:18:06 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356039 - head/sys/sys Message-ID: <201912232018.xBNKI6hi020301@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Dec 23 20:18:05 2019 New Revision: 356039 URL: https://svnweb.freebsd.org/changeset/base/356039 Log: Fix undefined behavior: left-shifting into the sign bit. Reviewed by: dim, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22898 Modified: head/sys/sys/_sigset.h head/sys/sys/bitset.h Modified: head/sys/sys/_sigset.h ============================================================================== --- head/sys/sys/_sigset.h Mon Dec 23 20:15:19 2019 (r356038) +++ head/sys/sys/_sigset.h Mon Dec 23 20:18:05 2019 (r356039) @@ -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: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Mon Dec 23 20:15:19 2019 (r356038) +++ head/sys/sys/bitset.h Mon Dec 23 20:18:05 2019 (r356039) @@ -41,7 +41,7 @@ #define __constexpr_cond(expr) (__builtin_constant_p((expr)) && (expr)) #define __bitset_mask(_s, n) \ - (1L << (__constexpr_cond(__bitset_words((_s)) == 1) ? \ + (1UL << (__constexpr_cond(__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?201912232018.xBNKI6hi020301>