Author: pfg
Date: Mon Sep  9 03:31:46 2019
New Revision: 352054
URL: https://svnweb.freebsd.org/changeset/base/352054

Log:
  ral(4): Use unsigned to avoid undefined behavior.
  
  Found by NetBSD's kUBSan
  
  Obtained from:        NetBSD (github 5b153f1)

Modified:
  head/sys/dev/ral/rt2860.c

Modified: head/sys/dev/ral/rt2860.c
==============================================================================
--- head/sys/dev/ral/rt2860.c   Mon Sep  9 01:33:45 2019        (r352053)
+++ head/sys/dev/ral/rt2860.c   Mon Sep  9 03:31:46 2019        (r352054)
@@ -2220,7 +2220,7 @@ static void
 rt2860_enable_mrr(struct rt2860_softc *sc)
 {
 #define CCK(mcs)       (mcs)
-#define OFDM(mcs)      (1 << 3 | (mcs))
+#define        OFDM(mcs)       (1U << 3 | (mcs))
        RAL_WRITE(sc, RT2860_LG_FBK_CFG0,
            OFDM(6) << 28 |     /* 54->48 */
            OFDM(5) << 24 |     /* 48->36 */
@@ -3325,7 +3325,7 @@ b4inc(uint32_t b32, int8_t delta)
                        b4 = 0;
                else if (b4 > 0xf)
                        b4 = 0xf;
-               b32 = b32 >> 4 | b4 << 28;
+               b32 = b32 >> 4 | (uint32_t)b4 << 28;
        }
        return b32;
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to