include/linux/tpm.h:290:2: warning: field within 'struct tpm_header' is less aligned than 'union tpm_header::(anonymous at include/linux/tpm.h:290:2)' and is usually due to 'struct tpm_header' being packed, which can lead to unaligned accesses

From: kernel test robot
Date: Sun Jan 07 2024 - 11:10:10 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 52b1853b080a082ec3749c3a9577f6c71b1d4a90
commit: be07858fbf8115fc74528292c2ee8775fe49116f KEYS: trusted: allow use of TEE as backend without TCG_TPM support
date: 1 year, 8 months ago
config: arm-randconfig-001-20240107 (https://download.01.org/0day-ci/archive/20240107/202401072350.jkkVKE5l-lkp@xxxxxxxxx/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240107/202401072350.jkkVKE5l-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401072350.jkkVKE5l-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from security/keys/trusted-keys/trusted_core.c:10:
In file included from include/keys/trusted-type.h:12:
>> include/linux/tpm.h:290:2: warning: field within 'struct tpm_header' is less aligned than 'union tpm_header::(anonymous at include/linux/tpm.h:290:2)' and is usually due to 'struct tpm_header' being packed, which can lead to unaligned accesses [-Wunaligned-access]
290 | union {
| ^
1 warning generated.


vim +290 include/linux/tpm.h

74edff2d74c64c Sumit Garg 2019-10-16 286
74edff2d74c64c Sumit Garg 2019-10-16 287 struct tpm_header {
74edff2d74c64c Sumit Garg 2019-10-16 288 __be16 tag;
74edff2d74c64c Sumit Garg 2019-10-16 289 __be32 length;
74edff2d74c64c Sumit Garg 2019-10-16 @290 union {
74edff2d74c64c Sumit Garg 2019-10-16 291 __be32 ordinal;
74edff2d74c64c Sumit Garg 2019-10-16 292 __be32 return_code;
74edff2d74c64c Sumit Garg 2019-10-16 293 };
74edff2d74c64c Sumit Garg 2019-10-16 294 } __packed;
74edff2d74c64c Sumit Garg 2019-10-16 295

:::::: The code at line 290 was first introduced by commit
:::::: 74edff2d74c64ca5977a57efb5c238c8f5318ba9 tpm: Move tpm_buf code to include/linux/

:::::: TO: Sumit Garg <sumit.garg@xxxxxxxxxx>
:::::: CC: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki