diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-08 14:59:17 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-08 14:59:17 +1000 |
commit | f395bd9c5c3bdfb241928c51beb548d5a905d46f (patch) | |
tree | 04c34819c159edb5809a8519b30bae4f255006da | |
parent | 73b89cf2e1cd2b90b730fef0f878eb0dfee7e12d (diff) | |
download | skiboot-f395bd9c5c3bdfb241928c51beb548d5a905d46f.zip skiboot-f395bd9c5c3bdfb241928c51beb548d5a905d46f.tar.gz skiboot-f395bd9c5c3bdfb241928c51beb548d5a905d46f.tar.bz2 |
fix potential divide by zero
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/device.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/device.c b/core/device.c index ba427de..807764c 100644 --- a/core/device.c +++ b/core/device.c @@ -805,6 +805,10 @@ unsigned int dt_count_addresses(const struct dt_node *node) p = dt_require_property(node, "reg", -1); n = (na + ns) * sizeof(u32); + + if (n == 0) + return 0; + return p->len / n; } |