Skip to contentSkip to conversation

arm64: fix endianness annotation in get_kaslr_seed()

PATCH New Luc Van Oostenryck 2 participants 3 messages Jun 28, 2017 – Jun 29, 2017 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: fix endianness annotation in get_kaslr_seed()

In the flattened device tree format, all integer properties are in big-endian order.
Here the property "kaslr-seed" is read from the fdt and then correctly converted to native order (via fdt64_to_cpu()) but the pointer used for this is not annotated as being for big-endian.

Fix this by declaring the pointer as __be64 instead of u64.

---
 arch/arm64/kernel/kaslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/kaslr.c +1 -1
index d7e90d97f..b9f0ec99e 100644
@@ -27,7 +27,7 @@ u16 __initdata memstart_offset_seed;
 static __init u64 get_kaslr_seed(void *fdt)
 {
 	int node, len;
-	u64 *prop;
+	__be64 *prop;
 	u64 ret;
 
 	node = fdt_path_offset(fdt, "/chosen");
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/1 arm64: fix endianness annotation in get_kaslr_seed()

Quoted 18 lines · Luc Van Oostenryck

In the flattened device tree format, all integer properties are in big-endian order.
Here the property "kaslr-seed" is read from the fdt and then correctly converted to native order (via fdt64_to_cpu()) but the pointer used for this is not annotated as being for big-endian.

Fix this by declaring the pointer as __be64 instead of u64.

---
 arch/arm64/kernel/kaslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/kaslr.c +0 -0
index d7e90d97f..b9f0ec99e 100644

arch/arm64/kernel/kaslr.c u16 __initdata memstart_offset_seed; · line 30

Quoted 5 lines
arch/arm64/kernel/kaslr.c +1 -1
@@ -27,7 +27,7 @@ u16 __initdata memstart_offset_seed;
 static __init u64 get_kaslr_seed(void *fdt)
 {
 	int node, len;
-	u64 *prop;
+	__be64 *prop;

I think this should be fdt64_t.

Will

#2 lore raw

PATCH v2 1/1 arm64: fix endianness annotation in get_kaslr_seed()

In the flattened device tree format, all integer properties are in big-endian order.
Here the property "kaslr-seed" is read from the fdt and then correctly converted to native order (via fdt64_to_cpu()) but the pointer used for this is not annotated as being for big-endian.

Fix this by declaring the pointer as fdt64_t instead of u64 (fdt64_t being itself typedefed to __be64).

---
Change since v1:
- use 'fdt64_t' instead of a plain '__be64'.

 arch/arm64/kernel/kaslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/kaslr.c +1 -1
index d7e90d97f..a9710efb8 100644
@@ -27,7 +27,7 @@ u16 __initdata memstart_offset_seed;
 static __init u64 get_kaslr_seed(void *fdt)
 {
 	int node, len;
-	u64 *prop;
+	fdt64_t *prop;
 	u64 ret;
 
 	node = fdt_path_offset(fdt, "/chosen");
Signature · 1 line
2.13.0