Module Name: src
Committed By: kamil
Date: Tue May 28 16:43:24 UTC 2019
Modified Files:
src/sys/arch/x86/x86: procfs_machdep.c
Log Message:
Avoid the 1<<31 construct
Shift unsigned int rather than signed one.
Detected with kUBSan when reading /proc/cpuinfo.
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/x86/procfs_machdep.c
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/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.31 src/sys/arch/x86/x86/procfs_machdep.c:1.32
--- src/sys/arch/x86/x86/procfs_machdep.c:1.31 Thu May 16 04:26:13 2019
+++ src/sys/arch/x86/x86/procfs_machdep.c Tue May 28 16:43:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_machdep.c,v 1.31 2019/05/16 04:26:13 msaitoh Exp $ */
+/* $NetBSD: procfs_machdep.c,v 1.32 2019/05/28 16:43:24 kamil Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.31 2019/05/16 04:26:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.32 2019/05/28 16:43:24 kamil Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -235,7 +235,7 @@ procfs_getonefeatreg(uint32_t reg, const
size_t l;
for (size_t i = 0; i < 32; i++) {
- if ((reg & (1 << i)) && table[i]) {
+ if ((reg & (1U << i)) && table[i]) {
l = snprintf(p, *left, "%s ", table[i]);
if (l < *left) {
*left -= l;