Skip to content

Commit

Permalink
zap_leaf: make l_hash[] variable length to silence UBSAN
Browse files Browse the repository at this point in the history
When UBSAN is active and OpenZFS is a debug build, the l_hash assert at
the bottom of zap_open_leaf() causes UBSAN to complain.

This follows the example in 786641d to shut it up.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #15964
  • Loading branch information
robn authored Apr 3, 2024
1 parent b6bbaa8 commit b21b967
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/sys/zap_leaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ typedef struct zap_leaf_phys {
* with the ZAP_LEAF_CHUNK() macro.
*/

uint16_t l_hash[1];
uint16_t l_hash[];
} zap_leaf_phys_t;

typedef union zap_leaf_chunk {
Expand Down

0 comments on commit b21b967

Please sign in to comment.