[uaccess] Remove trivial uses of userptr_t

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-24 01:30:50 +01:00
parent 945df9b429
commit e8ffe2cd64
34 changed files with 69 additions and 86 deletions
+1 -2
View File
@@ -110,8 +110,7 @@ static int efi_block_rw ( struct san_device *sandev, uint64_t lba,
}
/* Read from / write to block device */
if ( ( rc = sandev_rw ( sandev, lba, count,
virt_to_user ( data ) ) ) != 0 ) {
if ( ( rc = sandev_rw ( sandev, lba, count, data ) ) != 0 ) {
DBGC ( sandev->drive, "EFIBLK %#02x I/O failed: %s\n",
sandev->drive, strerror ( rc ) );
return rc;
+1 -2
View File
@@ -284,8 +284,7 @@ static int efi_bofm_start ( struct efi_device *efidev ) {
efi_handle_name ( device ) );
DBGC2_HD ( device, bofmtab2, bofmtab2->Parameters.Length );
}
bofmrc = bofm ( virt_to_user ( bofmtab2 ? bofmtab2 : bofmtab ),
&efipci.pci );
bofmrc = bofm ( ( bofmtab2 ? bofmtab2 : bofmtab ), &efipci.pci );
DBGC ( device, "EFIBOFM %s status %08x\n",
efi_handle_name ( device ), bofmrc );
DBGC2 ( device, "EFIBOFM %s version 1 after processing:\n",
+4 -6
View File
@@ -72,8 +72,7 @@ int efi_cachedhcp_record ( EFI_HANDLE device,
/* Record DHCPACK, if present */
if ( mode->DhcpAckReceived &&
( ( rc = cachedhcp_record ( &cached_dhcpack, vlan,
virt_to_user ( &mode->DhcpAck ),
( ( rc = cachedhcp_record ( &cached_dhcpack, vlan, &mode->DhcpAck,
sizeof ( mode->DhcpAck ) ) ) != 0 ) ) {
DBGC ( device, "EFI %s could not record DHCPACK: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
@@ -83,7 +82,7 @@ int efi_cachedhcp_record ( EFI_HANDLE device,
/* Record ProxyDHCPOFFER, if present */
if ( mode->ProxyOfferReceived &&
( ( rc = cachedhcp_record ( &cached_proxydhcp, vlan,
virt_to_user ( &mode->ProxyOffer ),
&mode->ProxyOffer,
sizeof ( mode->ProxyOffer ) ) ) != 0)){
DBGC ( device, "EFI %s could not record ProxyDHCPOFFER: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
@@ -92,9 +91,8 @@ int efi_cachedhcp_record ( EFI_HANDLE device,
/* Record PxeBSACK, if present */
if ( mode->PxeReplyReceived &&
( ( rc = cachedhcp_record ( &cached_pxebs, vlan,
virt_to_user ( &mode->PxeReply ),
sizeof ( mode->PxeReply ) ) ) != 0)){
( ( rc = cachedhcp_record ( &cached_pxebs, vlan, &mode->PxeReply,
sizeof ( mode->PxeReply ) ) ) != 0 )){
DBGC ( device, "EFI %s could not record PXEBSACK: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
return rc;
+7 -10
View File
@@ -177,12 +177,12 @@ static size_t efi_file_len ( struct efi_file *file ) {
* Read chunk of EFI file
*
* @v reader EFI file reader
* @v data Input data, or UNULL to zero-fill
* @v data Input data, or NULL to zero-fill
* @v len Length of input data
* @ret len Length of output data
*/
static size_t efi_file_read_chunk ( struct efi_file_reader *reader,
userptr_t data, size_t len ) {
const void *data, size_t len ) {
struct efi_file *file = reader->file;
size_t offset;
@@ -203,7 +203,7 @@ static size_t efi_file_read_chunk ( struct efi_file_reader *reader,
/* Copy or zero output data */
if ( data ) {
copy_from_user ( reader->data, data, offset, len );
memcpy ( reader->data, ( data + offset ), len );
} else {
memset ( reader->data, 0, len );
}
@@ -262,7 +262,7 @@ static size_t efi_file_read_initrd ( struct efi_file_reader *reader ) {
efi_file_name ( file ), reader->pos,
( reader->pos + pad_len ) );
}
len += efi_file_read_chunk ( reader, UNULL, pad_len );
len += efi_file_read_chunk ( reader, NULL, pad_len );
/* Read CPIO header(s), if applicable */
name = cpio_name ( image );
@@ -274,13 +274,10 @@ static size_t efi_file_read_initrd ( struct efi_file_reader *reader ) {
efi_file_name ( file ), reader->pos,
( reader->pos + cpio_len + pad_len ),
image->name );
len += efi_file_read_chunk ( reader,
virt_to_user ( &cpio ),
len += efi_file_read_chunk ( reader, &cpio,
sizeof ( cpio ) );
len += efi_file_read_chunk ( reader,
virt_to_user ( name ),
name_len );
len += efi_file_read_chunk ( reader, UNULL, pad_len );
len += efi_file_read_chunk ( reader, name, name_len );
len += efi_file_read_chunk ( reader, NULL, pad_len );
}
/* Read file data */
+2 -2
View File
@@ -273,7 +273,7 @@ static int vmbus_negotiate_version ( struct hv_hypervisor *hv ) {
* @v len Length of data buffer
* @ret gpadl GPADL ID, or negative error
*/
int vmbus_establish_gpadl ( struct vmbus_device *vmdev, userptr_t data,
int vmbus_establish_gpadl ( struct vmbus_device *vmdev, void *data,
size_t len ) {
struct hv_hypervisor *hv = vmdev->hv;
struct vmbus *vmbus = hv->vmbus;
@@ -442,7 +442,7 @@ int vmbus_open ( struct vmbus_device *vmdev,
memset ( ring, 0, len );
/* Establish GPADL for ring buffer */
gpadl = vmbus_establish_gpadl ( vmdev, virt_to_user ( ring ), len );
gpadl = vmbus_establish_gpadl ( vmdev, ring, len );
if ( gpadl < 0 ) {
rc = gpadl;
goto err_establish;
+1
View File
@@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/linux_api.h>
#include <ipxe/linux_sysfs.h>
+1
View File
@@ -19,6 +19,7 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include <string.h>
#include <errno.h>
#include <ipxe/linux_api.h>
#include <ipxe/linux_sysfs.h>
+3 -3
View File
@@ -42,8 +42,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v data Data to fill in
* @ret len Length read, or negative error
*/
int linux_sysfs_read ( const char *filename, userptr_t *data ) {
userptr_t tmp;
int linux_sysfs_read ( const char *filename, void **data ) {
void *tmp;
ssize_t read;
size_t len;
int fd;
@@ -59,7 +59,7 @@ int linux_sysfs_read ( const char *filename, userptr_t *data ) {
}
/* Read file */
for ( *data = UNULL, len = 0 ; ; len += read ) {
for ( *data = NULL, len = 0 ; ; len += read ) {
/* (Re)allocate space */
tmp = urealloc ( *data, ( len + LINUX_SYSFS_BLKSIZE ) );