[PATCH 1/1] boot: fix vbe_find_first_device()
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Tue Aug 23 10:25:25 CEST 2022
uclass_find_first_device() may return NULL if no device for the uclass
exists. Handle this case gracefully.
Addresses-Coverity: CID 356244 ("Null pointer dereferences (FORWARD_NULL)")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
boot/vbe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boot/vbe.c b/boot/vbe.c
index e6ee087dc2..52b3283003 100644
--- a/boot/vbe.c
+++ b/boot/vbe.c
@@ -40,7 +40,7 @@ int vbe_find_next_device(struct udevice **devp)
int vbe_find_first_device(struct udevice **devp)
{
uclass_find_first_device(UCLASS_BOOTMETH, devp);
- if (*devp && is_vbe(*devp))
+ if (!*devp || is_vbe(*devp))
return 0;
return vbe_find_next_device(devp);
--
2.36.1
More information about the U-Boot
mailing list