When reading a directory, EFI_BUFFER_TOO_SMALL should be returned when
the supplied buffer is too small, so a use-case is to call
efi_file_read with *buffer_size=0 and buffer=NULL to obtain the needed
size before doing the actual read.
So move the buffer!=NULL check to after the buffer size has been checked.
This fix allows the Redhat shim fallback to run and e.g. Fedora 32 now
boots out of the box.
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
efi_status_t ret;
loff_t file_size;
+ if (!buffer) {
+ ret = EFI_INVALID_PARAMETER;
+ return ret;
+ }
+
ret = efi_get_file_size(fh, &file_size);
if (ret != EFI_SUCCESS)
return ret;
fh->dent = dent;
return EFI_BUFFER_TOO_SMALL;
}
+ if (!buffer)
+ return EFI_INVALID_PARAMETER;
fh->dent = NULL;
*buffer_size = required_size;
EFI_ENTRY("%p, %p, %p", file, buffer_size, buffer);
- if (!buffer_size || !buffer) {
+ if (!buffer_size) {
ret = EFI_INVALID_PARAMETER;
goto error;
}