We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d1b488f commit 8041e83Copy full SHA for 8041e83
1 file changed
tools/fdt-parser/fdt-parser.c
@@ -192,10 +192,18 @@ static int fdt_test(void* fdt)
192
off = fdt_node_offset_by_compatible(fdt, -1, "fsl,qman-portal");
193
while (off != -FDT_ERR_NOTFOUND) {
194
const int *ci = fdt_getprop(fdt, off, "cell-index", NULL);
195
+ uint32_t portal_idx;
196
uint32_t liodns[2];
197
if (!ci)
198
break;
- i = fdt32_to_cpu(*ci);
199
+ portal_idx = fdt32_to_cpu(*ci);
200
+ if (portal_idx >= QMAN_NUM_PORTALS) {
201
+ printf("FDT: Invalid qman-portal cell-index %u at %d\n",
202
+ portal_idx, off);
203
+ ret = -FDT_ERR_BADSTRUCTURE;
204
+ goto exit;
205
+ }
206
+ i = (int)portal_idx;
207
208
liodns[0] = qp_info[i].dliodn;
209
liodns[1] = qp_info[i].fliodn;
0 commit comments