diff mbox

[U-Boot,05/10] fdt: Add a check to fdt_print() for coverity

Message ID 20170607162847.16971-6-sjg@chromium.org
State Accepted
Commit 9f95267271c0b6cff64c5ac1b308e1e0281e9e3a
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass June 7, 2017, 4:28 p.m. UTC
We know that fdt_getprop() does not return NULL when len is > 0 but
coverity does not. Add an extra check to keep it happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163248)
---

 cmd/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini June 12, 2017, 10:43 p.m. UTC | #1
On Wed, Jun 07, 2017 at 10:28:42AM -0600, Simon Glass wrote:

> We know that fdt_getprop() does not return NULL when len is > 0 but
> coverity does not. Add an extra check to keep it happy.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reported-by: Coverity (CID: 163248)

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox

Patch

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 3e889fc3bb..5d80eb2d00 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -962,7 +962,7 @@  static int fdt_print(const char *pathp, char *prop, int depth)
 			/* no property value */
 			printf("%s %s\n", pathp, prop);
 			return 0;
-		} else if (len > 0) {
+		} else if (nodep && len > 0) {
 			printf("%s = ", prop);
 			print_data (nodep, len);
 			printf("\n");