Skip to content

Commit

Permalink
Handle false array-bounds warning
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Dagnelie <[email protected]>
  • Loading branch information
pcd1193182 committed Oct 10, 2024
1 parent 0ddbdfd commit a32adac
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -4867,8 +4867,25 @@ spa_load_chain_map(spa_t *spa)
KM_SLEEP);
for (zap_cursor_init(&zc, os, chain_map_zap);
zap_cursor_retrieve(&zc, &attr) == 0; zap_cursor_advance(&zc)) {

/*
* Workaround for GCC 12+ with UBSan enabled deficencies.
*
* GCC 12+ invoked with -fsanitize=undefined incorrectly reports the code

Check failure on line 4874 in module/zfs/spa.c

View workflow job for this annotation

GitHub Actions / checkstyle

line > 80 characters
* below as violating -Warray-bounds
*/
#if defined(__GNUC__) && !defined(__clang__) && \
((!defined(_KERNEL) && defined(ZFS_UBSAN_ENABLED)) || defined(CONFIG_UBSAN))

Check failure on line 4878 in module/zfs/spa.c

View workflow job for this annotation

GitHub Actions / checkstyle

indent by spaces instead of tabs
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
uint64_t pool_guid = ((uint64_t *)attr.za_name)[0];
uint64_t os_guid = ((uint64_t *)attr.za_name)[1];
#if defined(__GNUC__) && !defined(__clang__) && \
((!defined(_KERNEL) && defined(ZFS_UBSAN_ENABLED)) || \

Check failure on line 4885 in module/zfs/spa.c

View workflow job for this annotation

GitHub Actions / checkstyle

indent by spaces instead of tabs
defined(CONFIG_UBSAN))

Check failure on line 4886 in module/zfs/spa.c

View workflow job for this annotation

GitHub Actions / checkstyle

indent by spaces instead of tabs
#pragma GCC diagnostic pop
#endif
error = zap_lookup_uint64(os, chain_map_zap,
(uint64_t *)attr.za_name, 2, sizeof (uint64_t),
sizeof (*szcmv) / sizeof (uint64_t),
Expand Down

0 comments on commit a32adac

Please sign in to comment.