From nobody Sun Sep 28 16:59:05 2025 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1758618689; cv=none; d=zohomail.com; s=zohoarc; b=UITVSbkf2oeagnLq4hvlJWX0g8z+nHSvsbHp5DOHIPc9+8FivzRURHd2BAV/3clkSDhpFEaL1D2jnV2o1Y5fk4urMICkjGqAexRaIl8l9Ld3m9+OG+/21Sw6rtYfi6+7xLt6teQUaivDVox/7RcuabEjlz3a7ZDiX/ePaEMH0+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758618689; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gBf257dfurfpa10gXBhTv1YNfzi+gIvQDWH94Yn0UZo=; b=NyFuTq18MWYROZUnmvQZsRUh2yG8434aO8oE3cq3TLWpKEAyZjJ/IOMxjoUh45jL5XdrtgtgPxVgZv6/6QlqJXt1Pvw+i/7xw3pYEvPOvwYrRMZmxgcxL9CCszf7D+CmfiUDcTWgRyKrEFFawLwg3SsYqnu2s8pOzEMKIRAVgqU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758618689261468.47555834988293; Tue, 23 Sep 2025 02:11:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v0z2a-0007Bb-W9; Tue, 23 Sep 2025 05:10:29 -0400 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 1v0z2U-000771-FM for qemu-devel@nongnu.org; Tue, 23 Sep 2025 05:10:23 -0400 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 1v0z2L-0000QH-2W for qemu-devel@nongnu.org; Tue, 23 Sep 2025 05:10:22 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-206-OGaaFWFFP32Xztm6i1Dn_w-1; Tue, 23 Sep 2025 05:10:07 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53D8219560AA; Tue, 23 Sep 2025 09:10:06 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.45.242.33]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0FFF81800577; Tue, 23 Sep 2025 09:10:06 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6B7C321E677A; Tue, 23 Sep 2025 11:10:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758618611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gBf257dfurfpa10gXBhTv1YNfzi+gIvQDWH94Yn0UZo=; b=AVbIuSHNzc2E/vAWFs/x1BRwxvderZl1Uw2ORytd1RT7LPUVgYK6ybZKUeSMWPEVClfS5U eylW+OrKm6xgVTzaKPCwH57Nkss2Bl+NsSZdg6q0P1On2zFzaM4uDhX5sIT5LxTf7Eirmh jcDSBMv2CknRqMx8aiVugaDnB6mEaAc= X-MC-Unique: OGaaFWFFP32Xztm6i1Dn_w-1 X-Mimecast-MFC-AGG-ID: OGaaFWFFP32Xztm6i1Dn_w_1758618606 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: odaki@rsg.ci.i.u-tokyo.ac.jp, marcandre.lureau@redhat.com, berrange@redhat.com, richard.henderson@linaro.org, vsementsov@yandex-team.ru Subject: [PATCH v3 08/13] util/oslib-win32: Do not treat null @errp as &error_warn Date: Tue, 23 Sep 2025 11:09:55 +0200 Message-ID: <20250923091000.3180122-9-armbru@redhat.com> In-Reply-To: <20250923091000.3180122-1-armbru@redhat.com> References: <20250923091000.3180122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.442, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1758618691683116600 qemu_socket_select() and its wrapper qemu_socket_unselect() treat a null @errp as &error_warn. This is wildly inappropriate. A caller passing null @errp specifies that errors are to be ignored. If warnings are wanted, the caller must pass &error_warn. Change callers to do that, and drop the inappropriate treatment of null @errp. This assumes that warnings are wanted. I'm not familiar with the calling code, so I can't say whether it will work when the socket is invalid, or WSAEventSelect() fails. If it doesn't, then this should be an error instead of a warning. Invalid socket might even be a programming error. These warnings were introduced in commit f5fd677ae7cf (win32/socket: introduce qemu_socket_select() helper). I considered reverting to silence, but Daniel Berrang=C3=A9 asked for the warnings to be preserved. Cc: Marc-Andr=C3=A9 Lureau Signed-off-by: Markus Armbruster Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- io/channel-socket.c | 4 ++-- io/channel-watch.c | 2 +- util/aio-win32.c | 2 +- util/oslib-win32.c | 6 +----- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index e53d9ac76f..fdc7670867 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -454,7 +454,7 @@ static void qio_channel_socket_finalize(Object *obj) } } #ifdef WIN32 - qemu_socket_unselect(ioc->fd, NULL); + qemu_socket_unselect(ioc->fd, &error_warn); #endif close(ioc->fd); ioc->fd =3D -1; @@ -929,7 +929,7 @@ qio_channel_socket_close(QIOChannel *ioc, =20 if (sioc->fd !=3D -1) { #ifdef WIN32 - qemu_socket_unselect(sioc->fd, NULL); + qemu_socket_unselect(sioc->fd, &error_warn); #endif if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_LISTEN)) { socket_listen_cleanup(sioc->fd, errp); diff --git a/io/channel-watch.c b/io/channel-watch.c index 64b486e378..ec76bd1ec6 100644 --- a/io/channel-watch.c +++ b/io/channel-watch.c @@ -283,7 +283,7 @@ GSource *qio_channel_create_socket_watch(QIOChannel *io= c, =20 qemu_socket_select(sockfd, ioc->event, FD_READ | FD_ACCEPT | FD_CLOSE | - FD_CONNECT | FD_WRITE | FD_OOB, NULL); + FD_CONNECT | FD_WRITE | FD_OOB, &error_warn); =20 source =3D g_source_new(&qio_channel_socket_source_funcs, sizeof(QIOChannelSocketSource)); diff --git a/util/aio-win32.c b/util/aio-win32.c index 6583d5c5f3..b125924433 100644 --- a/util/aio-win32.c +++ b/util/aio-win32.c @@ -121,7 +121,7 @@ void aio_set_fd_handler(AioContext *ctx, =20 QLIST_INSERT_HEAD_RCU(&ctx->aio_handlers, node, node); event =3D event_notifier_get_handle(&ctx->notifier); - qemu_socket_select(fd, event, bitmask, NULL); + qemu_socket_select(fd, event, bitmask, &error_warn); } if (old_node) { aio_remove_fd_handler(ctx, old_node); diff --git a/util/oslib-win32.c b/util/oslib-win32.c index b9ce2f96ee..6a2367c89d 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -182,7 +182,7 @@ bool qemu_set_blocking(int fd, bool block, Error **errp) unsigned long opt =3D block ? 0 : 1; =20 if (block) { - qemu_socket_unselect(fd, NULL); + qemu_socket_unselect(fd, &error_warn); } =20 if (ioctlsocket(fd, FIONBIO, &opt) !=3D NO_ERROR) { @@ -293,10 +293,6 @@ bool qemu_socket_select(int sockfd, WSAEVENT hEventObj= ect, { SOCKET s =3D _get_osfhandle(sockfd); =20 - if (errp =3D=3D NULL) { - errp =3D &error_warn; - } - if (s =3D=3D INVALID_SOCKET) { error_setg(errp, "invalid socket fd=3D%d", sockfd); return false; --=20 2.49.0