mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-13 20:36:02 +01:00
disk: part_dos: Fix a NULL pointer error
When ext is NULL we cannot dereference it. Update the code flow to avoid this, so that layout_mbr_partitions() can be used with partition tables that do not include an extended partition. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
362a79f3e8
commit
b7c2cc49ff
@ -459,10 +459,12 @@ int layout_mbr_partitions(struct disk_partition *p, int count,
|
|||||||
ext = &p[i];
|
ext = &p[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= 4 && !ext) {
|
if (count < 4)
|
||||||
printf("%s: extended partition is needed for more than 4 partitions\n",
|
return 0;
|
||||||
__func__);
|
|
||||||
return -1;
|
if (!ext) {
|
||||||
|
log_err("extended partition is needed for more than 4 partitions\n");
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate extended volumes start and size if needed */
|
/* calculate extended volumes start and size if needed */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user