* [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode
@ 2019-10-06 22:37 Heinrich Schuchardt
2019-10-06 23:39 ` Bin Meng
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2019-10-06 22:37 UTC (permalink / raw)
To: u-boot
With the __packed attribute sandbox_defconfig cannot be compiled with GCC
9.2.1:
fs/cbfs/cbfs.c: In function ‘file_cbfs_fill_cache’:
fs/cbfs/cbfs.c:164:16: error: taking address of packed member of
‘struct cbfs_cachenode’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
164 | cache_tail = &new_node->next;
| ^~~~~~~~~~~~~~~
struct cbfs_cachenode is only an internal structure. So let's rearrange the
fields such that the structure is naturally packed and remove the __packed
attribute.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
include/cbfs.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/cbfs.h b/include/cbfs.h
index 6d4c4d4b06..f3bc8ca24a 100644
--- a/include/cbfs.h
+++ b/include/cbfs.h
@@ -72,13 +72,13 @@ struct cbfs_fileheader {
struct cbfs_cachenode {
struct cbfs_cachenode *next;
- u32 type;
void *data;
- u32 data_length;
char *name;
+ u32 type;
+ u32 data_length;
u32 name_length;
u32 attributes_offset;
-} __packed;
+};
extern enum cbfs_result file_cbfs_result;
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode
2019-10-06 22:37 [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode Heinrich Schuchardt
@ 2019-10-06 23:39 ` Bin Meng
2019-10-10 17:06 ` Simon Glass
2019-11-02 9:33 ` Bin Meng
2 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2019-10-06 23:39 UTC (permalink / raw)
To: u-boot
On Mon, Oct 7, 2019 at 6:37 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> With the __packed attribute sandbox_defconfig cannot be compiled with GCC
> 9.2.1:
>
> fs/cbfs/cbfs.c: In function ‘file_cbfs_fill_cache’:
> fs/cbfs/cbfs.c:164:16: error: taking address of packed member of
> ‘struct cbfs_cachenode’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
> 164 | cache_tail = &new_node->next;
> | ^~~~~~~~~~~~~~~
>
> struct cbfs_cachenode is only an internal structure. So let's rearrange the
> fields such that the structure is naturally packed and remove the __packed
> attribute.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> include/cbfs.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode
2019-10-06 22:37 [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode Heinrich Schuchardt
2019-10-06 23:39 ` Bin Meng
@ 2019-10-10 17:06 ` Simon Glass
2019-11-02 9:33 ` Bin Meng
2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2019-10-10 17:06 UTC (permalink / raw)
To: u-boot
On Sun, 6 Oct 2019 at 15:38, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> With the __packed attribute sandbox_defconfig cannot be compiled with GCC
> 9.2.1:
>
> fs/cbfs/cbfs.c: In function ‘file_cbfs_fill_cache’:
> fs/cbfs/cbfs.c:164:16: error: taking address of packed member of
> ‘struct cbfs_cachenode’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
> 164 | cache_tail = &new_node->next;
> | ^~~~~~~~~~~~~~~
>
> struct cbfs_cachenode is only an internal structure. So let's rearrange the
> fields such that the structure is naturally packed and remove the __packed
> attribute.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> include/cbfs.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode
2019-10-06 22:37 [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode Heinrich Schuchardt
2019-10-06 23:39 ` Bin Meng
2019-10-10 17:06 ` Simon Glass
@ 2019-11-02 9:33 ` Bin Meng
2 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2019-11-02 9:33 UTC (permalink / raw)
To: u-boot
On Mon, Oct 7, 2019 at 6:37 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> With the __packed attribute sandbox_defconfig cannot be compiled with GCC
> 9.2.1:
>
> fs/cbfs/cbfs.c: In function ‘file_cbfs_fill_cache’:
> fs/cbfs/cbfs.c:164:16: error: taking address of packed member of
> ‘struct cbfs_cachenode’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
> 164 | cache_tail = &new_node->next;
> | ^~~~~~~~~~~~~~~
>
> struct cbfs_cachenode is only an internal structure. So let's rearrange the
> fields such that the structure is naturally packed and remove the __packed
> attribute.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> include/cbfs.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
applied to u-boot-x86, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-02 9:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-06 22:37 [U-Boot] [PATCH 1/1] cbfs: do not pack struct cbfs_cachenode Heinrich Schuchardt
2019-10-06 23:39 ` Bin Meng
2019-10-10 17:06 ` Simon Glass
2019-11-02 9:33 ` Bin Meng
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.