All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: fix endianness annotation in get_kaslr_seed()
@ 2017-06-28 14:58 Luc Van Oostenryck
  2017-06-29  9:59 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-06-28 14:58 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 arch/arm64/kernel/kaslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index d7e90d97f..b9f0ec99e 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -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");
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] arm64: fix endianness annotation in get_kaslr_seed()
  2017-06-28 14:58 [PATCH] arm64: fix endianness annotation in get_kaslr_seed() Luc Van Oostenryck
@ 2017-06-29  9:59 ` Will Deacon
  2017-06-29 14:35   ` [PATCH v2] " Luc Van Oostenryck
  0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2017-06-29  9:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 28, 2017 at 04:58:05PM +0200, Luc Van Oostenryck wrote:
> 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.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  arch/arm64/kernel/kaslr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
> index d7e90d97f..b9f0ec99e 100644
> --- a/arch/arm64/kernel/kaslr.c
> +++ b/arch/arm64/kernel/kaslr.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] arm64: fix endianness annotation in get_kaslr_seed()
  2017-06-29  9:59 ` Will Deacon
@ 2017-06-29 14:35   ` Luc Van Oostenryck
  0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-06-29 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

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).

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
Change since v1:
- use 'fdt64_t' instead of a plain '__be64'.

 arch/arm64/kernel/kaslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index d7e90d97f..a9710efb8 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -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");
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-29 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 14:58 [PATCH] arm64: fix endianness annotation in get_kaslr_seed() Luc Van Oostenryck
2017-06-29  9:59 ` Will Deacon
2017-06-29 14:35   ` [PATCH v2] " Luc Van Oostenryck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.