]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
ia64: mca_drv: fix incorrect array size calculation
authorArnd Bergmann <arnd@arndb.de>
Tue, 29 Jun 2021 02:33:41 +0000 (19:33 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:30:18 +0000 (09:30 +0200)
commit768800ef5f1b31de8dad6f2139dd4868eb8b6e2d
tree97faf6c99dd9b8e0022cf986c55ffc979776baae
parente622558fe8a495a360fdb41ff5078254ffb71557
ia64: mca_drv: fix incorrect array size calculation

BugLink: https://bugs.launchpad.net/bugs/1938340
[ Upstream commit c5f320ff8a79501bb59338278336ec43acb9d7e2 ]

gcc points out a mistake in the mca driver that goes back to before the
git history:

arch/ia64/kernel/mca_drv.c: In function 'init_record_index_pools':
arch/ia64/kernel/mca_drv.c:346:54: error: expression does not compute the number of elements in this array; element typ
e is 'int', not 'size_t' {aka 'long unsigned int'} [-Werror=sizeof-array-div]
  346 |         for (i = 1; i < sizeof sal_log_sect_min_sizes/sizeof(size_t); i++)
      |                                                      ^

This is the same as sizeof(size_t), which is two shorter than the actual
array.  Use the ARRAY_SIZE() macro to get the correct calculation instead.

Link: https://lkml.kernel.org/r/20210514214123.875971-1-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/ia64/kernel/mca_drv.c