]> git.proxmox.com Git - mirror_zfs.git/commitdiff
zap_leaf: make l_hash[] variable length to silence UBSAN
authorRob N <rob.norris@klarasystems.com>
Wed, 3 Apr 2024 23:38:18 +0000 (10:38 +1100)
committerGitHub <noreply@github.com>
Wed, 3 Apr 2024 23:38:18 +0000 (16:38 -0700)
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 786641dcf to shut it up.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #15964

include/sys/zap_leaf.h

index d563edd7ba59911b21351ff8b52b09f001bbb3e1..e54456d3472b0c5c7ed3e4c3570b43a3c4f43705 100644 (file)
@@ -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 {