Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/awin Avoid tripping on opposite-endian sysco...
details: https://anonhg.NetBSD.org/src/rev/a78f026502ce
branches: trunk
changeset: 351975:a78f026502ce
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Wed Mar 08 17:06:35 2017 +0000
description:
Avoid tripping on opposite-endian sysconfig/fex blobs.
diffstat:
sys/arch/evbarm/awin/awin_sysconfig.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (41 lines):
diff -r f312f4dbf5f6 -r a78f026502ce sys/arch/evbarm/awin/awin_sysconfig.c
--- a/sys/arch/evbarm/awin/awin_sysconfig.c Wed Mar 08 16:52:17 2017 +0000
+++ b/sys/arch/evbarm/awin/awin_sysconfig.c Wed Mar 08 17:06:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_sysconfig.c,v 1.2 2015/10/25 20:46:46 bouyer Exp $ */
+/* $NetBSD: awin_sysconfig.c,v 1.3 2017/03/08 17:06:35 jakllsch Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include "opt_allwinner.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_sysconfig.c,v 1.2 2015/10/25 20:46:46 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_sysconfig.c,v 1.3 2017/03/08 17:06:35 jakllsch Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -90,6 +90,8 @@
bool
awin_sysconfig_init(void)
{
+ struct awin_sysconfig_head head;
+
if (get_bootconf_option(boot_args, "sysconfig",
BOOTOPT_TYPE_HEXINT, &awin_sysconfig_base) == 0) {
return false;
@@ -102,6 +104,13 @@
(awin_sysconfig_base + KERNEL_BASE_VOFFSET);
memcpy(awin_sysconfig, sysconfig, AWIN_SYSCONFIG_SIZE);
+ memcpy(&head, &awin_sysconfig[0], sizeof(head));
+ if (head.count >= 0x01000000) {
+ printf("%s(): 0x%x entries in sysconfig, ignoring.\n",
+ __func__, head.count);
+ return false;
+ }
+
return true;
}
Home |
Main Index |
Thread Index |
Old Index