소스 검색

fdt: Add a check to fdt_print() for coverity

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)
Simon Glass 8 년 전
부모
커밋
9f95267271
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      cmd/fdt.c

+ 1 - 1
cmd/fdt.c

@@ -975,7 +975,7 @@ static int fdt_print(const char *pathp, char *prop, int depth)
 			/* no property value */
 			/* no property value */
 			printf("%s %s\n", pathp, prop);
 			printf("%s %s\n", pathp, prop);
 			return 0;
 			return 0;
-		} else if (len > 0) {
+		} else if (nodep && len > 0) {
 			printf("%s = ", prop);
 			printf("%s = ", prop);
 			print_data (nodep, len);
 			print_data (nodep, len);
 			printf("\n");
 			printf("\n");