summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2017-12-23 12:28:46 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2017-12-23 12:28:46 +0000
commita4f2122d371ba9150704f7033e2f65841d27b858 (patch)
tree3db69dda39f2d6c80ce7d86c01a4c97abb75a0a3 /sys/dev
parentdf5d27e566f975476f4cc74aaacd60107d4b5fbf (diff)
Avoid null-pointer dereference wen a device tree refers to a pin-function
that doesn't exist.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fdt/sxipio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/fdt/sxipio.c b/sys/dev/fdt/sxipio.c
index 7e113ed3243..2298bafb923 100644
--- a/sys/dev/fdt/sxipio.c
+++ b/sys/dev/fdt/sxipio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxipio.c,v 1.5 2017/11/13 09:24:59 kettenis Exp $ */
+/* $OpenBSD: sxipio.c,v 1.6 2017/12/23 12:28:45 kettenis Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
* Copyright (c) 2013 Artturi Alm
@@ -292,6 +292,8 @@ sxipio_pinctrl(uint32_t phandle, void *cookie)
/* Lookup the function of the pin. */
for (j = 0; j < nitems(sc->sc_pins[i].funcs); j++) {
+ if (sc->sc_pins[i].funcs[j].name == NULL)
+ continue;
if (strcmp(func, sc->sc_pins[i].funcs[j].name) == 0)
break;
}