mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
boot: Handle running out of labels
If only a single label is provided in the list, bootdev_next_label() does not operate correctly and reads beyond the end of the pointer list. Fix this by adding a new check. Also add a note to convert this array to an alist Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -579,6 +579,9 @@ int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp,
|
||||
struct udevice *dev;
|
||||
|
||||
log_debug("next\n");
|
||||
if (iter->cur_label >= 0 && !iter->labels[iter->cur_label])
|
||||
return log_msg_ret("fil", -ENODEV);
|
||||
|
||||
for (dev = NULL; !dev && iter->labels[++iter->cur_label];) {
|
||||
const char *label = iter->labels[iter->cur_label];
|
||||
int ret;
|
||||
|
||||
Reference in New Issue
Block a user