From nobody Sat Sep 21 02:32:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1705507523; cv=none; d=zohomail.com; s=zohoarc; b=UIQxMqXgOADPkAXwupe/OtwIIru1ewRIs0ItCLwnfIhpCROOE3YqQR2NCRAOIUAbhGj9jrXh8TtjlWINCXVPWUFBh4pVO9Cy3yNLVLS5VW4r+MIbDbv6G3vMUVsUSxWFVhZl5YD9YrZkA+/v8OtPdxNxzezHCpfKvr0pqxvWicc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705507523; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=POSfplYJhhtrbonAGHf8NJsAPu1Zh4NpOqbbGE6Reh8=; b=emAUHI8KcjCYbRIJkPGk3J75YX3AKEG95i9YT0h2uOwNM6w5ehPNPFXzmOrZfij7idwJJxOj+/aMzYx+J95HSYcZdv4pREc+mvsZH8ix8C2TObX7HrWZui6+CyoyHbadZZzgLIsNvGifujeh4WWXYi9oElOy5E//xBchKT9PEBY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705507523366915.9007250481033; Wed, 17 Jan 2024 08:05:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQ8Pg-00044b-8m; Wed, 17 Jan 2024 11:05:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQ8Pe-00044J-Mf for qemu-devel@nongnu.org; Wed, 17 Jan 2024 11:05:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQ8Pc-0008Kp-Tz for qemu-devel@nongnu.org; Wed, 17 Jan 2024 11:05:10 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-400-wu1fn8VdPeyRWDgrY2XuXw-1; Wed, 17 Jan 2024 11:05:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 856643C23FF7 for ; Wed, 17 Jan 2024 16:05:06 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF2F02166B32 for ; Wed, 17 Jan 2024 16:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705507508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=POSfplYJhhtrbonAGHf8NJsAPu1Zh4NpOqbbGE6Reh8=; b=K+ROvl9h/LTm9AzxFMVhE9/cATrey1/byQE3cUfh8krzAF9qUWN0Sa5s+xY54Mk+zofzBb t001t/lnG53lYppaAa4nMVKveeqDJ1OJ7BUh6k/H/45WBeB3fmfp1nATu0DDAP5y5DV3QJ huar1uWKQpt/+Igu92XW1ZSVobjEP9s= X-MC-Unique: wu1fn8VdPeyRWDgrY2XuXw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH] remove unnecessary casts from uintptr_t Date: Wed, 17 Jan 2024 17:05:00 +0100 Message-ID: <20240117160500.176509-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -38 X-Spam_score: -3.9 X-Spam_bar: --- X-Spam_report: (-3.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1705507524687100001 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Richard Henderson --- block/io_uring.c | 2 +- hw/vfio/common.c | 4 ++-- target/i386/sev.c | 8 ++++---- util/fdmon-io_uring.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/block/io_uring.c b/block/io_uring.c index 1e5886c30be..d77ae55745a 100644 --- a/block/io_uring.c +++ b/block/io_uring.c @@ -102,7 +102,7 @@ static void luring_resubmit_short_read(LuringState *s, = LuringAIOCB *luringcb, =20 /* Update sqe */ luringcb->sqeq.off +=3D nread; - luringcb->sqeq.addr =3D (__u64)(uintptr_t)luringcb->resubmit_qiov.iov; + luringcb->sqeq.addr =3D (uintptr_t)luringcb->resubmit_qiov.iov; luringcb->sqeq.len =3D luringcb->resubmit_qiov.niov; =20 luring_resubmit(s, luringcb); diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 0da4003ecf5..059bfdc07a8 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1000,7 +1000,7 @@ vfio_device_feature_dma_logging_start_create(VFIOCont= ainerBase *bcontainer, return NULL; } =20 - control->ranges =3D (__u64)(uintptr_t)ranges; + control->ranges =3D (uintptr_t)ranges; if (tracking->max32) { ranges->iova =3D tracking->min32; ranges->length =3D (tracking->max32 - tracking->min32) + 1; @@ -1126,7 +1126,7 @@ static int vfio_device_dma_logging_report(VFIODevice = *vbasedev, hwaddr iova, report->iova =3D iova; report->length =3D size; report->page_size =3D qemu_real_host_page_size(); - report->bitmap =3D (__u64)(uintptr_t)bitmap; + report->bitmap =3D (uintptr_t)bitmap; =20 feature->argsz =3D sizeof(buf); feature->flags =3D VFIO_DEVICE_FEATURE_GET | diff --git a/target/i386/sev.c b/target/i386/sev.c index 9a712466825..173de91afe7 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -167,7 +167,7 @@ sev_ioctl(int fd, int cmd, void *data, int *error) =20 input.id =3D cmd; input.sev_fd =3D fd; - input.data =3D (__u64)(unsigned long)data; + input.data =3D (uintptr_t)data; =20 r =3D kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, &input); =20 @@ -240,7 +240,7 @@ sev_ram_block_added(RAMBlockNotifier *n, void *host, si= ze_t size, return; } =20 - range.addr =3D (__u64)(unsigned long)host; + range.addr =3D (uintptr_t)host; range.size =3D max_size; =20 trace_kvm_memcrypt_register_region(host, max_size); @@ -270,7 +270,7 @@ sev_ram_block_removed(RAMBlockNotifier *n, void *host, = size_t size, return; } =20 - range.addr =3D (__u64)(unsigned long)host; + range.addr =3D (uintptr_t)host; range.size =3D max_size; =20 trace_kvm_memcrypt_unregister_region(host, max_size); @@ -767,7 +767,7 @@ sev_launch_update_data(SevGuestState *sev, uint8_t *add= r, uint64_t len) return 1; } =20 - update.uaddr =3D (__u64)(unsigned long)addr; + update.uaddr =3D (uintptr_t)addr; update.len =3D len; trace_kvm_sev_launch_update_data(addr, len); ret =3D sev_ioctl(sev->sev_fd, KVM_SEV_LAUNCH_UPDATE_DATA, diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c index 16054c5ede3..b0d68bdc44d 100644 --- a/util/fdmon-io_uring.c +++ b/util/fdmon-io_uring.c @@ -180,7 +180,7 @@ static void add_poll_remove_sqe(AioContext *ctx, AioHan= dler *node) struct io_uring_sqe *sqe =3D get_sqe(ctx); =20 #ifdef LIBURING_HAVE_DATA64 - io_uring_prep_poll_remove(sqe, (__u64)(uintptr_t)node); + io_uring_prep_poll_remove(sqe, (uintptr_t)node); #else io_uring_prep_poll_remove(sqe, node); #endif --=20 2.43.0