Module Name:    src
Committed By:   kamil
Date:           Sat Jul  7 21:35:16 UTC 2018

Modified Files:
        src/sys/arch/amd64/include: tss.h
        src/sys/arch/i386/include: tss.h

Log Message:
Correct unportable signed integer left shift in i386/amd64 tss code

Change the type of IOMAP_INVALOFF to unsigned int.

sys/arch/amd64/amd64/machdep.c:518:42, left shift of 65535 by 16 places cannot 
be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/include/tss.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/include/tss.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/tss.h
diff -u src/sys/arch/amd64/include/tss.h:1.7 src/sys/arch/amd64/include/tss.h:1.8
--- src/sys/arch/amd64/include/tss.h:1.7	Thu Jan  4 14:02:23 2018
+++ src/sys/arch/amd64/include/tss.h	Sat Jul  7 21:35:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tss.h,v 1.7 2018/01/04 14:02:23 maxv Exp $	*/
+/*	$NetBSD: tss.h,v 1.8 2018/07/07 21:35:16 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -63,7 +63,7 @@ struct x86_64_tss {
  * I/O bitmap offset beyond TSS's segment limit means no bitmaps.
  * (i.e. any I/O attempt generates an exception.)
  */
-#define	IOMAP_INVALOFF	0xffff
+#define	IOMAP_INVALOFF	0xffffu
 
 /*
  * If we have an I/O bitmap, there is only one valid offset.

Index: src/sys/arch/i386/include/tss.h
diff -u src/sys/arch/i386/include/tss.h:1.11 src/sys/arch/i386/include/tss.h:1.12
--- src/sys/arch/i386/include/tss.h:1.11	Thu Jan  4 14:02:23 2018
+++ src/sys/arch/i386/include/tss.h	Sat Jul  7 21:35:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tss.h,v 1.11 2018/01/04 14:02:23 maxv Exp $	*/
+/*	$NetBSD: tss.h,v 1.12 2018/07/07 21:35:16 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -74,7 +74,7 @@ struct i386tss {
  * I/O bitmap offset beyond TSS's segment limit means no bitmaps.
  * (i.e. any I/O attempt generates an exception.)
  */
-#define	IOMAP_INVALOFF	0xffff
+#define	IOMAP_INVALOFF	0xffffu
 
 /*
  * If we have an I/O bitmap, there is only one valid offset.

Reply via email to