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.

Signed-off-by: Rob Norris <[email protected]>
Sponsored-by: https://despairlabs.com/sponsor/
  • Loading branch information
robn committed Mar 27, 2024
1 parent 8cd8ccc commit 3f51b97
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 3f51b97

Please sign in to comment.