lib/bootloader-zipl: check for errors when opening initrd

This adds a missing error check when opening an initrd in s390x
Secure Execution (SE) logic.
It was detected by RH internal static checks.
This commit is contained in:
Luca BRUNO 2022-10-13 10:48:38 +00:00
parent e0cc8069c9
commit 39ef6253e9
No known key found for this signature in database
GPG Key ID: A9834A2252078E4E
1 changed files with 2 additions and 1 deletions

View File

@ -273,7 +273,8 @@ _ostree_secure_execution_generate_initrd (const gchar *initrd,
return glnx_prefix_error (error, "s390x SE: opening new ramdisk"); return glnx_prefix_error (error, "s390x SE: opening new ramdisk");
{ {
glnx_autofd int fd = -1; glnx_autofd int fd = -1;
glnx_openat_rdonly (AT_FDCWD, initrd, TRUE, &fd, error); if (!glnx_openat_rdonly (AT_FDCWD, initrd, TRUE, &fd, error))
return glnx_prefix_error (error, "s390x SE: opening initrd");
if (glnx_regfile_copy_bytes (fd, out_initrd->fd, (off_t) -1) < 0) if (glnx_regfile_copy_bytes (fd, out_initrd->fd, (off_t) -1) < 0)
return glnx_throw_errno_prefix (error, "s390x SE: copying ramdisk"); return glnx_throw_errno_prefix (error, "s390x SE: copying ramdisk");
} }