mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-07 17:11:46 +00:00
trivial: Prevent critical warning when the EFI variable has no data
I don't think this can happen in reality, but I hit it when mocking up an efivar directory using FWUPD_SYSFSFWDIR with a 4 byte file.
This commit is contained in:
parent
35e701556f
commit
c3b973a91e
@ -250,6 +250,13 @@ fu_efivar_get_data_impl (const gchar *guid, const gchar *name, guint8 **data,
|
|||||||
|
|
||||||
/* read out the data */
|
/* read out the data */
|
||||||
data_sz_tmp = sz - sizeof(attr_tmp);
|
data_sz_tmp = sz - sizeof(attr_tmp);
|
||||||
|
if (data_sz_tmp == 0) {
|
||||||
|
g_set_error_literal (error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_DATA,
|
||||||
|
"no data to read");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (data_sz != NULL)
|
if (data_sz != NULL)
|
||||||
*data_sz = data_sz_tmp;
|
*data_sz = data_sz_tmp;
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user