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>
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 84be0d5..7edec90 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -292,10 +292,8 @@
 		void *buffer)
 {
 	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))
 		return EFI_DEVICE_ERROR;
 
@@ -425,7 +423,7 @@
 		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)) {
 		ret = EFI_DEVICE_ERROR;
 		goto error;