Skip to content

Commit 592d0bc

Browse files
committed
remove unnecessary casts from uintptr_t
uintptr_t, or unsigned long which is equivalent on Linux I32LP64 systems, is an unsigned type and there is no need to further cast to __u64 which is another unsigned integer type; widening casts from unsigned integers zero-extend the value. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 729ba8e commit 592d0bc

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

block/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static void luring_resubmit_short_read(LuringState *s, LuringAIOCB *luringcb,
102102

103103
/* Update sqe */
104104
luringcb->sqeq.off += nread;
105-
luringcb->sqeq.addr = (__u64)(uintptr_t)luringcb->resubmit_qiov.iov;
105+
luringcb->sqeq.addr = (uintptr_t)luringcb->resubmit_qiov.iov;
106106
luringcb->sqeq.len = luringcb->resubmit_qiov.niov;
107107

108108
luring_resubmit(s, luringcb);

hw/vfio/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ vfio_device_feature_dma_logging_start_create(VFIOContainerBase *bcontainer,
10001000
return NULL;
10011001
}
10021002

1003-
control->ranges = (__u64)(uintptr_t)ranges;
1003+
control->ranges = (uintptr_t)ranges;
10041004
if (tracking->max32) {
10051005
ranges->iova = tracking->min32;
10061006
ranges->length = (tracking->max32 - tracking->min32) + 1;
@@ -1126,7 +1126,7 @@ static int vfio_device_dma_logging_report(VFIODevice *vbasedev, hwaddr iova,
11261126
report->iova = iova;
11271127
report->length = size;
11281128
report->page_size = qemu_real_host_page_size();
1129-
report->bitmap = (__u64)(uintptr_t)bitmap;
1129+
report->bitmap = (uintptr_t)bitmap;
11301130

11311131
feature->argsz = sizeof(buf);
11321132
feature->flags = VFIO_DEVICE_FEATURE_GET |

target/i386/sev.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ sev_ioctl(int fd, int cmd, void *data, int *error)
167167

168168
input.id = cmd;
169169
input.sev_fd = fd;
170-
input.data = (__u64)(unsigned long)data;
170+
input.data = (uintptr_t)data;
171171

172172
r = kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, &input);
173173

@@ -240,7 +240,7 @@ sev_ram_block_added(RAMBlockNotifier *n, void *host, size_t size,
240240
return;
241241
}
242242

243-
range.addr = (__u64)(unsigned long)host;
243+
range.addr = (uintptr_t)host;
244244
range.size = max_size;
245245

246246
trace_kvm_memcrypt_register_region(host, max_size);
@@ -270,7 +270,7 @@ sev_ram_block_removed(RAMBlockNotifier *n, void *host, size_t size,
270270
return;
271271
}
272272

273-
range.addr = (__u64)(unsigned long)host;
273+
range.addr = (uintptr_t)host;
274274
range.size = max_size;
275275

276276
trace_kvm_memcrypt_unregister_region(host, max_size);
@@ -767,7 +767,7 @@ sev_launch_update_data(SevGuestState *sev, uint8_t *addr, uint64_t len)
767767
return 1;
768768
}
769769

770-
update.uaddr = (__u64)(unsigned long)addr;
770+
update.uaddr = (uintptr_t)addr;
771771
update.len = len;
772772
trace_kvm_sev_launch_update_data(addr, len);
773773
ret = sev_ioctl(sev->sev_fd, KVM_SEV_LAUNCH_UPDATE_DATA,

util/fdmon-io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHandler *node)
180180
struct io_uring_sqe *sqe = get_sqe(ctx);
181181

182182
#ifdef LIBURING_HAVE_DATA64
183-
io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node);
183+
io_uring_prep_poll_remove(sqe, (uintptr_t)node);
184184
#else
185185
io_uring_prep_poll_remove(sqe, node);
186186
#endif

0 commit comments

Comments
 (0)