Module Name: src
Committed By: kamil
Date: Sat Jul 7 23:05:50 UTC 2018
Modified Files:
src/sys/arch/x86/x86: mpbios.c
Log Message:
Remove unaligned access to mpbios_page[]
Replace unaligned pointer dereference with a more portable construct that
is free from Undefined Behavior semantics.
sys/arch/x86/x86/mpbios.c:308:11, load of misaligned address 0xffff800031c7a413
for type 'const __uint16_t' which requires 2 byte alignment
Detected with Kernel Undefined Behavior Sanitizer
To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x86/x86/mpbios.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/mpbios.c
diff -u src/sys/arch/x86/x86/mpbios.c:1.66 src/sys/arch/x86/x86/mpbios.c:1.67
--- src/sys/arch/x86/x86/mpbios.c:1.66 Tue May 23 03:18:40 2017
+++ src/sys/arch/x86/x86/mpbios.c Sat Jul 7 23:05:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mpbios.c,v 1.66 2017/05/23 03:18:40 nonaka Exp $ */
+/* $NetBSD: mpbios.c,v 1.67 2018/07/07 23:05:50 kamil Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.66 2017/05/23 03:18:40 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.67 2018/07/07 23:05:50 kamil Exp $");
#include "acpica.h"
#include "lapic.h"
@@ -305,7 +305,8 @@ mpbios_probe(device_t self)
ebda = *(const uint16_t *)(&mpbios_page[0x40e]);
ebda <<= 4;
- memtop = *(const uint16_t *)(&mpbios_page[0x413]);
+ memtop = mpbios_page[0x413];
+ memtop |= (uint16_t)mpbios_page[0x414] << 8;
memtop <<= 10;
mpbios_page = NULL;