Skip to contentSkip to conversation

scripts/dtc: Update to upstream version v1.6.1-66-gabbd523bae6e

PATCH In review Rob Herring 2 participants 2 messages Feb 3, 2023 Device tree

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 scripts/dtc: Update to upstream version v1.6.1-66-gabbd523bae6e

This adds the following commits from upstream:

abbd523bae6e pylibfdt: Work-around SWIG limitations with flexible arrays a41509bea3e7 libfdt: Replace deprecated 0-length arrays with proper flexible arrays 2cd89f862cdb dtc: Warning rather than error on possible truncation of cell values

---
 scripts/dtc/dtc-parser.y  | 11 ++++++++---
 scripts/dtc/libfdt/fdt.h  |  4 ++--
 scripts/dtc/version_gen.h |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)
scripts/dtc/dtc-parser.y +8 -3
index 46457d4bc0aa..bff1337ec266 100644
@@ -404,9 +404,14 @@ arrayprefix:
 				 * within the mask to one (i.e. | in the
 				 * mask), all bits are one.
 				 */
-				if (($2 > mask) && (($2 | mask) != -1ULL))
-					ERROR(&@2, "Value out of range for"
-					      " %d-bit array element", $1.bits);
+				if (($2 > mask) && (($2 | mask) != -1ULL)) {
+					char *loc = srcpos_string(&@2);
+					fprintf(stderr,
+						"WARNING: %s: Value 0x%016" PRIx64
+						" truncated to 0x%0*" PRIx64 "\n",
+						loc, $2, $1.bits / 4, ($2 & mask));
+					free(loc);
+				}
 			}
 
 			$$.data = data_append_integer($1.data, $2, $1.bits);
scripts/dtc/libfdt/fdt.h +2 -2
index f2e68807f277..0c91aa7f67b5 100644
@@ -35,14 +35,14 @@ struct fdt_reserve_entry {
 
 struct fdt_node_header {
 	fdt32_t tag;
-	char name[0];
+	char name[];
 };
 
 struct fdt_property {
 	fdt32_t tag;
 	fdt32_t len;
 	fdt32_t nameoff;
-	char data[0];
+	char data[];
 };
 
 #endif /* !__ASSEMBLY */
scripts/dtc/version_gen.h +1 -1
index 0f303087b043..99614ec1a289 100644
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.6.1-g55778a03"
+#define DTC_VERSION "DTC 1.6.1-gabbd523b"
Signature · 1 line
2.39.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Rob Herring

This adds the following commits from upstream:

abbd523bae6e pylibfdt: Work-around SWIG limitations with flexible arrays a41509bea3e7 libfdt: Replace deprecated 0-length arrays with proper flexible arrays 2cd89f862cdb dtc: Warning rather than error on possible truncation of cell values

Thanks for your help with this!

-Kees

Quoted 59 lines
---
 scripts/dtc/dtc-parser.y  | 11 ++++++++---
 scripts/dtc/libfdt/fdt.h  |  4 ++--
 scripts/dtc/version_gen.h |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)
scripts/dtc/dtc-parser.y +8 -3
index 46457d4bc0aa..bff1337ec266 100644
@@ -404,9 +404,14 @@ arrayprefix:
 				 * within the mask to one (i.e. | in the
 				 * mask), all bits are one.
 				 */
-				if (($2 > mask) && (($2 | mask) != -1ULL))
-					ERROR(&@2, "Value out of range for"
-					      " %d-bit array element", $1.bits);
+				if (($2 > mask) && (($2 | mask) != -1ULL)) {
+					char *loc = srcpos_string(&@2);
+					fprintf(stderr,
+						"WARNING: %s: Value 0x%016" PRIx64
+						" truncated to 0x%0*" PRIx64 "\n",
+						loc, $2, $1.bits / 4, ($2 & mask));
+					free(loc);
+				}
 			}
 
 			$$.data = data_append_integer($1.data, $2, $1.bits);
scripts/dtc/libfdt/fdt.h +2 -2
index f2e68807f277..0c91aa7f67b5 100644
@@ -35,14 +35,14 @@ struct fdt_reserve_entry {
 
 struct fdt_node_header {
 	fdt32_t tag;
-	char name[0];
+	char name[];
 };
 
 struct fdt_property {
 	fdt32_t tag;
 	fdt32_t len;
 	fdt32_t nameoff;
-	char data[0];
+	char data[];
 };
 
 #endif /* !__ASSEMBLY */
scripts/dtc/version_gen.h +1 -1
index 0f303087b043..99614ec1a289 100644
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.6.1-g55778a03"
+#define DTC_VERSION "DTC 1.6.1-gabbd523b"
Signature · 1 line
2.39.0
Signature · 1 line
Kees Cook