diff mbox series

[U-Boot,1/1] net: nfs: remove superfluous packed attribute

Message ID 20190902220505.25296-1-xypron.glpk@gmx.de
State Accepted
Commit 5a5d1def59024dd3225e2a6142f8ee3ee10180a8
Delegated to: Joe Hershberger
Headers show
Series [U-Boot,1/1] net: nfs: remove superfluous packed attribute | expand

Commit Message

Heinrich Schuchardt Sept. 2, 2019, 10:05 p.m. UTC
With GCC 9.2.1 net/nfs.c leads to multiple errors of type
address-of-packed-member.

net/nfs.c: In function ‘rpc_req’:
net/nfs.c:199:18: error: taking address of packed member of
‘struct rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  199 |  p = (uint32_t *)&(rpc_pkt.u.call.data);
      |                  ^~~~~~~~~~~~~~~~~~~~~~
net/nfs.c: In function ‘nfs_readlink_reply’:
net/nfs.c:631:46: error: taking address of packed member of
‘struct rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  631 |    nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
      |                               ~~~~~~~~~~~~~~~^~~~~
  LD      drivers/block/built-in.o
net/nfs.c: In function ‘nfs_read_reply’:
net/nfs.c:692:46: error: taking address of packed member of
‘struct rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  692 |    nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
      |                               ~~~~~~~~~~~~~~~^~~~~

struct rpc_t is only used as local variable. It is naturally packed. So
there is no need for the attribute packed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 net/nfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.23.0.rc1

Comments

Bin Meng Sept. 2, 2019, 10:53 p.m. UTC | #1
On Tue, Sep 3, 2019 at 6:05 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> With GCC 9.2.1 net/nfs.c leads to multiple errors of type
> address-of-packed-member.
>
> net/nfs.c: In function ‘rpc_req’:
> net/nfs.c:199:18: error: taking address of packed member of
> ‘struct rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   199 |  p = (uint32_t *)&(rpc_pkt.u.call.data);
>       |                  ^~~~~~~~~~~~~~~~~~~~~~
> net/nfs.c: In function ‘nfs_readlink_reply’:
> net/nfs.c:631:46: error: taking address of packed member of
> ‘struct rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   631 |    nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
>       |                               ~~~~~~~~~~~~~~~^~~~~
>   LD      drivers/block/built-in.o
> net/nfs.c: In function ‘nfs_read_reply’:
> net/nfs.c:692:46: error: taking address of packed member of
> ‘struct rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   692 |    nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
>       |                               ~~~~~~~~~~~~~~~^~~~~
>
> struct rpc_t is only used as local variable. It is naturally packed. So
> there is no need for the attribute packed.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  net/nfs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Joe Hershberger Sept. 3, 2019, 11:51 p.m. UTC | #2
On Mon, Sep 2, 2019 at 5:05 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> With GCC 9.2.1 net/nfs.c leads to multiple errors of type
> address-of-packed-member.
>
> net/nfs.c: In function ‘rpc_req’:
> net/nfs.c:199:18: error: taking address of packed member of
> ‘struct rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   199 |  p = (uint32_t *)&(rpc_pkt.u.call.data);
>       |                  ^~~~~~~~~~~~~~~~~~~~~~
> net/nfs.c: In function ‘nfs_readlink_reply’:
> net/nfs.c:631:46: error: taking address of packed member of
> ‘struct rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   631 |    nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
>       |                               ~~~~~~~~~~~~~~~^~~~~
>   LD      drivers/block/built-in.o
> net/nfs.c: In function ‘nfs_read_reply’:
> net/nfs.c:692:46: error: taking address of packed member of
> ‘struct rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   692 |    nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
>       |                               ~~~~~~~~~~~~~~~^~~~~
>
> struct rpc_t is only used as local variable. It is naturally packed. So
> there is no need for the attribute packed.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Sept. 4, 2019, 4:42 p.m. UTC | #3
Hi Heinrich,

https://patchwork.ozlabs.org/patch/1156731/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/net/nfs.h b/net/nfs.h
index a377c90088..68ada0efeb 100644
--- a/net/nfs.h
+++ b/net/nfs.h
@@ -78,7 +78,7 @@  struct rpc_t {
 				NFS_MAX_ATTRS];
 		} reply;
 	} u;
-} __attribute__((packed));
+};
 void nfs_start(void);	/* Begin NFS */