|
@@ -290,7 +290,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
|
|
struct device_node *p;
|
|
struct device_node *p;
|
|
const __be32 *intspec, *tmp, *addr;
|
|
const __be32 *intspec, *tmp, *addr;
|
|
u32 intsize, intlen;
|
|
u32 intsize, intlen;
|
|
- int i, res = -EINVAL;
|
|
|
|
|
|
+ int i, res;
|
|
|
|
|
|
pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index);
|
|
pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index);
|
|
|
|
|
|
@@ -323,15 +323,19 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
|
|
|
|
|
|
/* Get size of interrupt specifier */
|
|
/* Get size of interrupt specifier */
|
|
tmp = of_get_property(p, "#interrupt-cells", NULL);
|
|
tmp = of_get_property(p, "#interrupt-cells", NULL);
|
|
- if (tmp == NULL)
|
|
|
|
|
|
+ if (tmp == NULL) {
|
|
|
|
+ res = -EINVAL;
|
|
goto out;
|
|
goto out;
|
|
|
|
+ }
|
|
intsize = be32_to_cpu(*tmp);
|
|
intsize = be32_to_cpu(*tmp);
|
|
|
|
|
|
pr_debug(" intsize=%d intlen=%d\n", intsize, intlen);
|
|
pr_debug(" intsize=%d intlen=%d\n", intsize, intlen);
|
|
|
|
|
|
/* Check index */
|
|
/* Check index */
|
|
- if ((index + 1) * intsize > intlen)
|
|
|
|
|
|
+ if ((index + 1) * intsize > intlen) {
|
|
|
|
+ res = -EINVAL;
|
|
goto out;
|
|
goto out;
|
|
|
|
+ }
|
|
|
|
|
|
/* Copy intspec into irq structure */
|
|
/* Copy intspec into irq structure */
|
|
intspec += index * intsize;
|
|
intspec += index * intsize;
|