[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <536e1ed3-5d6b-401e-b8b4-888b49aba6df@www.fastmail.com>
Date: Sat, 17 Sep 2022 10:16:03 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "kernel test robot" <lkp@...el.com>,
"Karsten Graul" <kgraul@...ux.ibm.com>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: Re: net/smc/smc_llc.c:26:2: warning: field within 'struct smc_llc_hdr' is
less aligned than 'union smc_llc_hdr::(anonymous at net/smc/smc_llc.c:26:2)'
and is usually due to 'struct smc_llc_hdr' being packed, which can lead to
unaligned accesses
On Sat, Sep 17, 2022, at 10:09 AM, kernel test robot wrote:
> Hi Karsten,
>
> FYI, the error/warning still remains.
>
>
>>> net/smc/smc_llc.c:26:2: warning: field within 'struct smc_llc_hdr' is less aligned than 'union smc_llc_hdr::(anonymous at net/smc/smc_llc.c:26:2)' and is usually due to 'struct smc_llc_hdr' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> union {
> ^
> 1 warning generated.
>
>
> vim +26 net/smc/smc_llc.c
>
> 23
> 24 struct smc_llc_hdr {
> 25 struct smc_wr_rx_hdr common;
> > 26 union {
> 27 struct {
> 28 u8 length; /* 44 */
> 29 #if defined(__BIG_ENDIAN_BITFIELD)
> 30 u8 reserved:4,
> 31 add_link_rej_rsn:4;
> 32 #elif defined(__LITTLE_ENDIAN_BITFIELD)
> 33 u8 add_link_rej_rsn:4,
> 34 reserved:4;
> 35 #endif
> 36 };
> 37 u16 length_v2; /* 44 - 8192*/
> 38 };
> 39 u8 flags;
> 40 } __packed; /* format defined in
> 41 * IBM Shared Memory Communications Version 2
I think the __packed annotation should be moved to the
length_v2 field instead of the outer struct to resolve that.
Arnd
Powered by blists - more mailing lists