Make sure fdt_find_node() returns NULL if it can't find the requested node.
authorpatrick <patrick@openbsd.org>
Sat, 5 Nov 2022 18:56:09 +0000 (18:56 +0000)
committerpatrick <patrick@openbsd.org>
Sat, 5 Nov 2022 18:56:09 +0000 (18:56 +0000)
ok kettenis@

sys/arch/arm64/stand/efiboot/fdt.c
sys/arch/armv7/stand/efiboot/fdt.c
sys/arch/riscv64/stand/efiboot/fdt.c

index e2c3a8a..b1e3d6e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: fdt.c,v 1.6 2022/03/14 19:09:32 kettenis Exp $        */
+/*     $OpenBSD: fdt.c,v 1.7 2022/11/05 18:56:09 patrick Exp $ */
 
 /*
  * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
@@ -494,6 +494,9 @@ fdt_find_node(char *name)
                        }
                }
 
+               if (child == NULL)
+                       return NULL; /* No match found. */
+
                p = q;
        }
 
index 3556a5a..9c49b84 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: fdt.c,v 1.8 2022/03/14 19:09:32 kettenis Exp $        */
+/*     $OpenBSD: fdt.c,v 1.9 2022/11/05 18:56:09 patrick Exp $ */
 
 /*
  * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
@@ -494,6 +494,9 @@ fdt_find_node(char *name)
                        }
                }
 
+               if (child == NULL)
+                       return NULL; /* No match found. */
+
                p = q;
        }
 
index 45a280f..7fbc0a8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: fdt.c,v 1.2 2022/03/14 19:09:32 kettenis Exp $        */
+/*     $OpenBSD: fdt.c,v 1.3 2022/11/05 18:56:09 patrick Exp $ */
 
 /*
  * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
@@ -494,6 +494,9 @@ fdt_find_node(char *name)
                        }
                }
 
+               if (child == NULL)
+                       return NULL; /* No match found. */
+
                p = q;
        }