Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/cortex Apply similar fix from gic.c that fixed ...



details:   https://anonhg.NetBSD.org/src/rev/5b02e5862c98
branches:  trunk
changeset: 1009128:5b02e5862c98
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Apr 13 12:14:55 2020 +0000

description:
Apply similar fix from gic.c that fixed "left shift of 255 by 24 places
cannot be represented in type 'int'" warnings from UBSan.

diffstat:

 sys/arch/arm/cortex/gicv3.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r ce658d60909d -r 5b02e5862c98 sys/arch/arm/cortex/gicv3.c
--- a/sys/arch/arm/cortex/gicv3.c       Mon Apr 13 12:14:04 2020 +0000
+++ b/sys/arch/arm/cortex/gicv3.c       Mon Apr 13 12:14:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.24 2020/02/13 02:12:06 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.25 2020/04/13 12:14:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #define        _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.24 2020/02/13 02:12:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.25 2020/04/13 12:14:55 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -178,7 +178,7 @@
                        gicr_write_4(sc, n, GICR_ICFGRn(is->is_irq / 16), icfg);
 
                        ipriority = gicr_read_4(sc, n, GICR_IPRIORITYRn(is->is_irq / 4));
-                       ipriority &= ~(0xff << ipriority_shift);
+                       ipriority &= ~(0xffU << ipriority_shift);
                        ipriority |= (ipriority_val << ipriority_shift);
                        gicr_write_4(sc, n, GICR_IPRIORITYRn(is->is_irq / 4), ipriority);
                }
@@ -202,7 +202,7 @@
 
                /* Update interrupt priority */
                ipriority = gicd_read_4(sc, GICD_IPRIORITYRn(is->is_irq / 4));
-               ipriority &= ~(0xff << ipriority_shift);
+               ipriority &= ~(0xffU << ipriority_shift);
                ipriority |= (ipriority_val << ipriority_shift);
                gicd_write_4(sc, GICD_IPRIORITYRn(is->is_irq / 4), ipriority);
        }
@@ -277,7 +277,7 @@
                for (o = 0; o < 4; o++, byte_shift += 8) {
                        struct intrsource * const is = sc->sc_pic.pic_sources[n + o];
                        if (is == NULL)
-                               priority |= 0xff << byte_shift;
+                               priority |= (0xffU << byte_shift);
                        else {
                                const u_int ipriority_val = IPL_TO_PRIORITY(sc, is->is_ipl);
                                priority |= ipriority_val << byte_shift;



Home | Main Index | Thread Index | Old Index