Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Sep 2019 03:31:46 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352054 - head/sys/dev/ral
Message-ID:  <201909090331.x893Vkje082289@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 }



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