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 <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
  • Loading branch information
robn committed Mar 5, 2024
1 parent 8f2f6cd commit 0617b41
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 0617b41

Please sign in to comment.