Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist Use unsigned to avoid undefined b...



details:   https://anonhg.NetBSD.org/src/rev/e75f8aeda54f
branches:  trunk
changeset: 460288:e75f8aeda54f
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 16 01:44:48 2019 +0000

description:
Use unsigned to avoid undefined behavior. Found by kUBSan.

diffstat:

 sys/external/bsd/drm2/dist/drm/radeon/r600d.h      |  4 ++--
 sys/external/bsd/drm2/dist/drm/radeon/rv770d.h     |  6 +++---
 sys/external/bsd/drm2/dist/include/drm/drm_fixed.h |  4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r bb008f3a9e8b -r e75f8aeda54f sys/external/bsd/drm2/dist/drm/radeon/r600d.h
--- a/sys/external/bsd/drm2/dist/drm/radeon/r600d.h     Tue Oct 15 19:29:58 2019 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/r600d.h     Wed Oct 16 01:44:48 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: r600d.h,v 1.3 2019/08/17 15:50:05 msaitoh Exp $        */
+/*     $NetBSD: r600d.h,v 1.4 2019/10/16 01:44:48 msaitoh Exp $        */
 
 /*
  * Copyright 2009 Advanced Micro Devices, Inc.
@@ -644,7 +644,7 @@
 #define DMA_MODE                                          0xd0bc
 
 /* async DMA packets */
-#define DMA_PACKET(cmd, t, s, n)       ((((cmd) & 0xF) << 28) |        \
+#define DMA_PACKET(cmd, t, s, n)       ((((u32)(cmd) & 0xF) << 28) |   \
                                         (((t) & 0x1) << 23) |          \
                                         (((s) & 0x1) << 22) |          \
                                         (((n) & 0xFFFF) << 0))
diff -r bb008f3a9e8b -r e75f8aeda54f sys/external/bsd/drm2/dist/drm/radeon/rv770d.h
--- a/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h    Tue Oct 15 19:29:58 2019 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h    Wed Oct 16 01:44:48 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rv770d.h,v 1.2 2018/08/27 04:58:36 riastradh Exp $     */
+/*     $NetBSD: rv770d.h,v 1.3 2019/10/16 01:44:48 msaitoh Exp $       */
 
 /*
  * Copyright 2009 Advanced Micro Devices, Inc.
@@ -563,7 +563,7 @@
 #define        SQ_DYN_GPR_SIZE_SIMD_AB_5                       0x8DC4
 #define        SQ_DYN_GPR_SIZE_SIMD_AB_6                       0x8DC8
 #define        SQ_DYN_GPR_SIZE_SIMD_AB_7                       0x8DCC
-#define                ES_PRIO(x)                                      ((x) << 30)
+#define                ES_PRIO(x)                                      ((u32)(x) << 30)
 #define        SQ_GPR_RESOURCE_MGMT_1                          0x8C04
 #define                NUM_PS_GPRS(x)                                  ((x) << 0)
 #define                NUM_VS_GPRS(x)                                  ((x) << 16)
@@ -661,7 +661,7 @@
 #define DMA_RB_WPTR                                       0xd00c
 
 /* async DMA packets */
-#define DMA_PACKET(cmd, t, s, n)       ((((cmd) & 0xF) << 28) |        \
+#define DMA_PACKET(cmd, t, s, n)       ((((u32)(cmd) & 0xF) << 28) |   \
                                         (((t) & 0x1) << 23) |          \
                                         (((s) & 0x1) << 22) |          \
                                         (((n) & 0xFFFF) << 0))
diff -r bb008f3a9e8b -r e75f8aeda54f sys/external/bsd/drm2/dist/include/drm/drm_fixed.h
--- a/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h        Tue Oct 15 19:29:58 2019 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h        Wed Oct 16 01:44:48 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_fixed.h,v 1.2 2018/08/27 04:58:37 riastradh Exp $  */
+/*     $NetBSD: drm_fixed.h,v 1.3 2019/10/16 01:44:48 msaitoh Exp $    */
 
 /*
  * Copyright 2009 Red Hat Inc.
@@ -34,7 +34,7 @@
 } fixed20_12;
 
 
-#define dfixed_const(A) (u32)(((A) << 12))/*  + ((B + 0.000122)*4096)) */
+#define dfixed_const(A) (((u32)(A) << 12))/*  + ((B + 0.000122)*4096)) */
 #define dfixed_const_half(A) (u32)(((A) << 12) + 2048)
 #define dfixed_const_666(A) (u32)(((A) << 12) + 2731)
 #define dfixed_const_8(A) (u32)(((A) << 12) + 3277)



Home | Main Index | Thread Index | Old Index