From: kettenis Date: Sat, 23 Dec 2017 12:28:45 +0000 (+0000) Subject: Avoid null-pointer dereference wen a device tree refers to a pin-function X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d7887d3a6ed5f778463021769fb2068c662905b1;p=openbsd Avoid null-pointer dereference wen a device tree refers to a pin-function that doesn't exist. --- 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; }