summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_bus_fdt.c
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-12-13 03:35:47 +0000
committergonzo <gonzo@FreeBSD.org>2012-12-13 03:35:47 +0000
commit6682c5a493b04594b14b47bef25ea5d5b28da6d6 (patch)
treea935c1d613337d12ffe88aa493cedfcbd6929fcf /sys/dev/uart/uart_bus_fdt.c
parent9f85b220e0029a457a844c4cf89eb122c5d35f31 (diff)
downloadFreeBSD-src-6682c5a493b04594b14b47bef25ea5d5b28da6d6.zip
FreeBSD-src-6682c5a493b04594b14b47bef25ea5d5b28da6d6.tar.gz
Prevent possible usage of uninitialized pbase variable by checking
return value of fdt_get_range
Diffstat (limited to 'sys/dev/uart/uart_bus_fdt.c')
-rw-r--r--sys/dev/uart/uart_bus_fdt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/uart/uart_bus_fdt.c b/sys/dev/uart/uart_bus_fdt.c
index 8dbbb25..b55329e 100644
--- a/sys/dev/uart/uart_bus_fdt.c
+++ b/sys/dev/uart/uart_bus_fdt.c
@@ -206,8 +206,10 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
err = fdt_regsize(node, &start, &size);
if (err)
return (ENXIO);
+ err = fdt_get_range(OF_parent(node), 0, &pbase, &psize);
+ if (err)
+ pbase = 0;
- fdt_get_range(OF_parent(node), 0, &pbase, &psize);
start += pbase;
return (bus_space_map(di->bas.bst, start, size, 0, &di->bas.bsh));
OpenPOWER on IntegriCloud