Skip to contentSkip to conversation

drivers/hid/hid-nvidia-shield.c:59:2: warning: field within 'struct thunderstrike_hostcmd_resp_report' is less aligned than 'union thunderstrike_hostcmd_resp_report::(anonymous at drivers/hid/hid-nvidia-shield.c:59:2)' and is usually due to 'struct thund...

DISCUSSION kernel test robot 2 participants 2 messages Jul 4, 2023

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   24be4d0b46bb0c3c1dc7bacd30957d6144a70dfc
commit: 09308562d4afb1abc66366608fa1cb9de783272f HID: nvidia-shield: Initial driver implementation with Thunderstrike support
date:   4 weeks ago
config: arm-randconfig-r014-20230704 (https://download.01.org/0day-ci/archive/20230704/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce: (https://download.01.org/0day-ci/archive/20230704/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/hid/hid-nvidia-shield.c:59:2: warning: field  within 'struct thunderstrike_hostcmd_resp_report' is less aligned than 'union thunderstrike_hostcmd_resp_report::(anonymous at drivers/hid/hid-nvidia-shield.c:59:2)' and is usually due to 'struct thunderstrike_hostcmd_resp_report' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           union {
           ^

1 warning generated.

vim +59 drivers/hid/hid-nvidia-shield.c

    53	
    54	struct thunderstrike_hostcmd_resp_report {
    55		u8 report_id; /* THUNDERSTRIKE_HOSTCMD_RESP_REPORT_ID */
    56		u8 cmd_id;
    57		u8 reserved_at_10;
    58	
  > 59		union {
    60			struct thunderstrike_hostcmd_board_info board_info;
    61			struct thunderstrike_hostcmd_haptics motors;
    62			__le16 fw_version;
    63			u8 payload[30];
    64		};
    65	} __packed;
    66	static_assert(sizeof(struct thunderstrike_hostcmd_resp_report) ==
    67		      THUNDERSTRIKE_HOSTCMD_REPORT_SIZE);
    68	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 30 lines · On Tue, 04 Jul, 2023 15:13:08 +0800 kernel test robot <[email protected]> wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   24be4d0b46bb0c3c1dc7bacd30957d6144a70dfc
commit: 09308562d4afb1abc66366608fa1cb9de783272f HID: nvidia-shield: Initial driver implementation with Thunderstrike support
date:   4 weeks ago
config: arm-randconfig-r014-20230704 (https://download.01.org/0day-ci/archive/20230704/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce: (https://download.01.org/0day-ci/archive/20230704/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/hid/hid-nvidia-shield.c:59:2: warning: field within 'struct thunderstrike_hostcmd_resp_report' is less aligned than 'union thunderstrike_hostcmd_resp_report::(anonymous at drivers/hid/hid-nvidia-shield.c:59:2)' and is usually due to 'struct thunderstrike_hostcmd_resp_report' being packed, which can lead to unaligned accesses [-Wunaligned-access]

           union {
           ^

1 warning generated.

vim +59 drivers/hid/hid-nvidia-shield.c

    53	
    54	struct thunderstrike_hostcmd_resp_report {
    55		u8 report_id; /* THUNDERSTRIKE_HOSTCMD_RESP_REPORT_ID */
    56		u8 cmd_id;
    57		u8 reserved_at_10;
    58	
Quoted 1 line

59 union {

Quoted 9 lines
    60			struct thunderstrike_hostcmd_board_info board_info;
    61			struct thunderstrike_hostcmd_haptics motors;
    62			__le16 fw_version;
    63			u8 payload[30];
    64		};
    65	} __packed;
    66	static_assert(sizeof(struct thunderstrike_hostcmd_resp_report) ==
    67		      THUNDERSTRIKE_HOSTCMD_REPORT_SIZE);
    68	

Will send out a fix for this soon.

-- Rahul Rameshbabu