various: do not use assert_se as a workaround in non-test code

This partially reverts 5332be60d3. I expect that
there is no practical difference, but it seems philosophically wrong to use
assert_se(), i.e. for the generation of the code in non-debug builds, just to
suppress a warning. We have _unused_ for that, use it.

I verified that we don't get warnings with clang and -DNDEBUG=1 with this patch.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-04-29 21:59:32 +09:00
committed by Yu Watanabe
parent bd4ab24f49
commit 7dcbb48e46
3 changed files with 12 additions and 10 deletions
+3 -2
View File
@@ -4723,9 +4723,10 @@ static int tpm2_kdfe(
if (!info)
return log_oom_debug();
void *end = mempcpy(mempcpy(stpcpy(info, label) + 1, context_u, context_u_size), context_v, context_v_size);
_unused_ void *end = mempcpy(mempcpy(stpcpy(info, label) + 1, context_u, context_u_size),
context_v, context_v_size);
/* assert we copied exactly the right amount that we allocated */
assert_se(end > info && (uintptr_t) end - (uintptr_t) info == info_len);
assert(end > info && (uintptr_t) end - (uintptr_t) info == info_len);
_cleanup_free_ void *buf = NULL;
r = kdf_ss_derive(