mirror of
https://github.com/ipxe/ipxe
synced 2026-04-16 03:00:10 +03:00
[uaccess] Add explicit casts to and from userptr_t where needed
Allow for the possibility of userptr_t becoming a pointer type by adding explicit casts where necessary. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -96,10 +96,10 @@ UACCESS_INLINE ( librm, phys_to_user ) ( unsigned long phys_addr ) {
|
||||
* identity-mapped.
|
||||
*/
|
||||
if ( sizeof ( physaddr_t ) > sizeof ( uint32_t ) )
|
||||
return phys_addr;
|
||||
return ( ( userptr_t ) phys_addr );
|
||||
|
||||
/* In a 32-bit build, subtract virt_offset */
|
||||
return ( phys_addr - virt_offset );
|
||||
return ( ( userptr_t ) ( phys_addr - virt_offset ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ UACCESS_INLINE ( librm, phys_to_user ) ( unsigned long phys_addr ) {
|
||||
*/
|
||||
static inline __always_inline unsigned long
|
||||
UACCESS_INLINE ( librm, user_to_phys ) ( userptr_t userptr, off_t offset ) {
|
||||
unsigned long addr = ( userptr + offset );
|
||||
unsigned long addr = ( ( unsigned long ) ( userptr + offset ) );
|
||||
|
||||
/* In a 64-bit build, any virtual address in the low 4GB is
|
||||
* directly usable as a physical address, since the low 4GB is
|
||||
|
||||
@@ -45,7 +45,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define EM_ALIGN ( 4 * 1024 )
|
||||
|
||||
/** Equivalent of NOWHERE for user pointers */
|
||||
#define UNOWHERE ( ~UNULL )
|
||||
#define UNOWHERE ( ( userptr_t ) ~( ( intptr_t ) 0 ) )
|
||||
|
||||
/** An external memory block */
|
||||
struct external_memory {
|
||||
|
||||
Reference in New Issue
Block a user