Whamcloud - gitweb
ext2fs: fix -Walloc-size
authorSam James <sam@gentoo.org>
Tue, 7 Nov 2023 23:31:20 +0000 (23:31 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 17 Apr 2024 04:36:01 +0000 (00:36 -0400)
commitaa11daba2081da28ec70c557eefd5039a99555a3
treeb253931379ee9b6d60eddb6dbc32bff1dd2f5abe
parent1275bbaaea7ffd42346789f945c2f4dcddbfbbc8
ext2fs: fix -Walloc-size

GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
lib/ext2fs/hashmap.c:37:36: warning: allocation of insufficient size ‘1’ for type ‘struct ext2fs_hashmap’ with size ‘20’ [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(...)`. GCC then sees we're not
doing anything wrong.

Signed-off-by: Sam James <sam@gentoo.org>
Link: https://lore.kernel.org/r/20231107233122.2013191-1-sam@gentoo.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/hashmap.c