device: Fix 0xFFFF crash when generating fiasco image without hwrev
This commit is contained in:
1 parent
bacbb0165b
commit
8a9e2759d4
1 file changed
+8
-6
+8
-6
@@ -184,9 +184,11 @@ char ** device_list_alloc_to_bufs(const struct device_list * device_list) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; device_first->hwrevs[i] != -1; ++i )
|
if ( device_first->hwrevs ) {
|
||||||
if ( device_first->hwrevs[i] >= 0 && device_first->hwrevs[i] <= 9999 )
|
for ( i = 0; device_first->hwrevs[i] != -1; ++i )
|
||||||
++local;
|
if ( device_first->hwrevs[i] >= 0 && device_first->hwrevs[i] <= 9999 )
|
||||||
|
++local;
|
||||||
|
}
|
||||||
|
|
||||||
size += (1+16+(MAX_HWREVS+1)*8)*(local/MAX_HWREVS+1);
|
size += (1+16+(MAX_HWREVS+1)*8)*(local/MAX_HWREVS+1);
|
||||||
count += local/MAX_HWREVS;
|
count += local/MAX_HWREVS;
|
||||||
@@ -215,7 +217,7 @@ char ** device_list_alloc_to_bufs(const struct device_list * device_list) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( device_first->hwrevs[i+1] != -1 ) {
|
do {
|
||||||
|
|
||||||
uint8_t len = 0;
|
uint8_t len = 0;
|
||||||
ret[j] = ++last_ptr;
|
ret[j] = ++last_ptr;
|
||||||
@@ -228,7 +230,7 @@ char ** device_list_alloc_to_bufs(const struct device_list * device_list) {
|
|||||||
|
|
||||||
for ( k = 0; k < MAX_HWREVS; ++k ) {
|
for ( k = 0; k < MAX_HWREVS; ++k ) {
|
||||||
|
|
||||||
if ( device_first->hwrevs[i+1] == -1 )
|
if ( ! device_first->hwrevs || device_first->hwrevs[i+1] == -1 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
@@ -246,7 +248,7 @@ char ** device_list_alloc_to_bufs(const struct device_list * device_list) {
|
|||||||
|
|
||||||
++j;
|
++j;
|
||||||
|
|
||||||
}
|
} while ( device_first->hwrevs && device_first->hwrevs[i+1] != -1 );
|
||||||
|
|
||||||
device_first = device_first->next;
|
device_first = device_first->next;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user