aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/of_private.h
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2021-04-08 15:45:08 -0500
committerRob Herring <robh@kernel.org>2021-04-08 16:38:47 -0500
commit48d499bd89191b359a6dbe44d32107e3021571c2 (patch)
tree2fa58efa7eeb0a6367f6efbcd4b5f4438a1fdfc0 /drivers/of/of_private.h
parentof: properly check for error returned by fdt_get_name() (diff)
downloadlinux-dev-48d499bd89191b359a6dbe44d32107e3021571c2.tar.xz
linux-dev-48d499bd89191b359a6dbe44d32107e3021571c2.zip
of: unittest: overlay: ensure proper alignment of copied FDT
The Devicetree standard specifies an 8 byte alignment of the FDT. Code in libfdt expects this alignment for an FDT image in memory. kmemdup() returns 4 byte alignment on openrisc. Replace kmemdup() with kmalloc(), align pointer, memcpy() to get proper alignment. The 4 byte alignment exposed a related bug which triggered a crash on openrisc with: commit 79edff12060f ("scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9") as reported in: https://lore.kernel.org/lkml/20210327224116.69309-1-linux@roeck-us.net/ Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Frank Rowand <frank.rowand@sony.com> Link: https://lore.kernel.org/r/20210408204508.2276230-1-frowand.list@gmail.com Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/of_private.h')
-rw-r--r--drivers/of/of_private.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index d9e6a324de0a..d717efbd637d 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -8,6 +8,8 @@
* Copyright (C) 1996-2005 Paul Mackerras.
*/
+#define FDT_ALIGN_SIZE 8
+
/**
* struct alias_prop - Alias property in 'aliases' node
* @link: List node to link the structure in aliases_lookup list