Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm bus_space_is_equal: fix crash when called w...
details: https://anonhg.NetBSD.org/src/rev/49c1f5c2c179
branches: trunk
changeset: 1023610:49c1f5c2c179
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Sep 18 09:49:57 2021 +0000
description:
bus_space_is_equal: fix crash when called with NULL tag
diffstat:
sys/arch/arm/arm/bus_stubs.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r 199e82649845 -r 49c1f5c2c179 sys/arch/arm/arm/bus_stubs.c
--- a/sys/arch/arm/arm/bus_stubs.c Sat Sep 18 06:32:41 2021 +0000
+++ b/sys/arch/arm/arm/bus_stubs.c Sat Sep 18 09:49:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_stubs.c,v 1.2 2021/09/08 11:02:05 jmcneill Exp $ */
+/* $NetBSD: bus_stubs.c,v 1.3 2021/09/18 09:49:57 jmcneill Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_stubs.c,v 1.2 2021/09/08 11:02:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_stubs.c,v 1.3 2021/09/18 09:49:57 jmcneill Exp $");
#include <sys/systm.h>
#include <sys/asan.h>
@@ -40,7 +40,11 @@
bool
bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t t2)
{
- return t1->bs_cookie == t2->bs_cookie;
+ if (t1 == t2) {
+ return true;
+ }
+
+ return t1 != NULL && t2 != NULL && t1->bs_cookie == t2->bs_cookie;
}
int
Home |
Main Index |
Thread Index |
Old Index