mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Fix GCC 12 compilation errors
Squelch false positives reported by GCC 12 with UBSan. Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #14150
This commit is contained in:
+2
-1
@@ -171,7 +171,8 @@ static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
|
||||
/*
|
||||
* Silence infinite recursion warning which was added to -Wall in gcc 12.1
|
||||
*/
|
||||
#if defined(HAVE_INFINITE_RECURSION)
|
||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||
defined(HAVE_KERNEL_INFINITE_RECURSION)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Winfinite-recursion"
|
||||
#endif
|
||||
|
||||
@@ -229,8 +229,26 @@ zio_crypt_key_init(uint64_t crypt, zio_crypt_key_t *key)
|
||||
ASSERT(key != NULL);
|
||||
ASSERT3U(crypt, <, ZIO_CRYPT_FUNCTIONS);
|
||||
|
||||
/*
|
||||
* Workaround for GCC 12+ with UBSan enabled deficencies.
|
||||
*
|
||||
* GCC 12+ invoked with -fsanitize=undefined incorrectly reports the code
|
||||
* below as violating -Warray-bounds
|
||||
*/
|
||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||
((!defined(_KERNEL) && defined(ZFS_UBSAN_ENABLED)) || \
|
||||
defined(CONFIG_UBSAN))
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
#endif
|
||||
keydata_len = zio_crypt_table[crypt].ci_keylen;
|
||||
bzero(key, sizeof (zio_crypt_key_t));
|
||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||
((!defined(_KERNEL) && defined(ZFS_UBSAN_ENABLED)) || \
|
||||
defined(CONFIG_UBSAN))
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
memset(key, 0, sizeof (zio_crypt_key_t));
|
||||
|
||||
/* fill keydata buffers and salt with random data */
|
||||
ret = random_get_bytes((uint8_t *)&key->zk_guid, sizeof (uint64_t));
|
||||
|
||||
Reference in New Issue
Block a user