mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
efi: Correct the operation of efi_file_write()
We should not directly cast between pointers and addresses since it breaks sandbox. Fix this and simplify the code in file_read(). Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
428aa0ca56
commit
2ae843f732
1 changed files with 2 additions and 4 deletions
|
@ -292,10 +292,8 @@ static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size,
|
||||||
void *buffer)
|
void *buffer)
|
||||||
{
|
{
|
||||||
loff_t actread;
|
loff_t actread;
|
||||||
/* fs_read expects buffer address, not pointer */
|
|
||||||
uintptr_t buffer_addr = (uintptr_t)map_to_sysmem(buffer);
|
|
||||||
|
|
||||||
if (fs_read(fh->path, buffer_addr, fh->offset,
|
if (fs_read(fh->path, map_to_sysmem(buffer), fh->offset,
|
||||||
*buffer_size, &actread))
|
*buffer_size, &actread))
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
|
|
||||||
|
@ -425,7 +423,7 @@ static efi_status_t EFIAPI efi_file_write(struct efi_file_handle *file,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs_write(fh->path, (ulong)buffer, fh->offset, *buffer_size,
|
if (fs_write(fh->path, map_to_sysmem(buffer), fh->offset, *buffer_size,
|
||||||
&actwrite)) {
|
&actwrite)) {
|
||||||
ret = EFI_DEVICE_ERROR;
|
ret = EFI_DEVICE_ERROR;
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Add table
Reference in a new issue