From: Zbigniew Jędrzejewski-Szmek Date: Wed, 17 Sep 2025 07:37:03 +0000 (+0200) Subject: efivars: adjust location of variable attribute X-Git-Tag: v259-rc1~529^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b974789799dab2c4f1aba6f028d9dfc518e291a;p=thirdparty%2Fsystemd.git efivars: adjust location of variable attribute I also thought about converting efi_set_variable() to use writev, but we don't have loop_writev. I'm not sure if the loop around write here is important. Coinceivably, it could make a difference it we were writing a long value. The loop was introduced in b7749eb517ff5dd379cf61ee9fb50a0105ab2c0f, without much comment unfortunately. So it doesn't seem worth the risk of changing this to not use a loop, and writing loop_writev just for this also seems overkill. --- diff --git a/src/basic/efivars.c b/src/basic/efivars.c index 8185a111d16..c30469d136f 100644 --- a/src/basic/efivars.c +++ b/src/basic/efivars.c @@ -219,10 +219,10 @@ static int efi_verify_variable(const char *variable, uint32_t attr, const void * int efi_set_variable(const char *variable, const void *value, size_t size) { static const uint32_t attr = EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS; - struct var { + _cleanup_free_ struct var { uint32_t attr; char buf[]; - } _packed_ * _cleanup_free_ buf = NULL; + } _packed_ *buf = NULL; _cleanup_close_ int fd = -EBADF; bool saved_flags_valid = false; unsigned saved_flags;