From nobody Mon Nov 23 04:34:25 2026 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=1794484070; cv=none; d=zohomail.com; s=zohoarc; b=e7UbpQaCRtMxduw7bQOA1UgmjRd0Pa2zUy7fmFvS2sfr8qQG0yx5x8TwJkOJfZKjJ+108ZBItxSKsisbaYPhDeGr3TXyjYZBfQrMxWNJ/ZNcs1Go85lGOSuaCbdDtBnYcfVdDwco3g52uhxcfGQv4Fcu823FtSCFeIHI0RTPmX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794484070; h=Content-Type:Content-Transfer-Encoding:Cc:Cc: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; bh=WZzmaphdwlRT1lhH9QpwpByJNjS20c+e//bOysFhTVs=; b=WIqrvHEhH09kytsIssTpTtB/e9KlBi8P2aRzNsvw15CJkKGLU2jJz/2CRWWCOOnOfSKGle7qAgs6bPijidlHgEUvIIwOZXguwoSZZ6VMfTbKWS2QGT3YIHOM15RyQdF5lY0d55XqM5/h8A+a5BtPaLC47ye0DK6/BtfRNtmyXD0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17944840709412.963108136857386; Thu, 12 Nov 2026 03:47:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xRTGw-0002pc-9x; Thu, 12 Nov 2026 06:47:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xRTGu-0002ot-NL for qemu-devel@nongnu.org; Thu, 12 Nov 2026 06:47:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xRTGs-0006kB-SK for qemu-devel@nongnu.org; Thu, 12 Nov 2026 06:47:16 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-249-HPU2uTDDM3qhcyAoQRpNPQ-1; Thu, 12 Nov 2026 06:47:07 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A8F53187983B; Thu, 12 Nov 2026 11:47:05 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.44.22.7]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2910D1956086; Thu, 12 Nov 2026 11:47:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C479621E6A04; Thu, 12 Nov 2026 12:47:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1794484032; 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; bh=WZzmaphdwlRT1lhH9QpwpByJNjS20c+e//bOysFhTVs=; b=RH4ny2jZwh/9iEEMbJA/E85vyxOZ6NFjS9fj+d1RMDI83bV2onXZUthWwhc9n0fJyh8SGr Ui27oqej26ipm3FETjYWUUjaqJVwsj6FYEm8hxb5nn80gsVRuslaQQRkxGLpse3QxDWgXC 8OUojprKJl0/N0EmNoPKqb4cehkdHfY= X-MC-Unique: HPU2uTDDM3qhcyAoQRpNPQ-1 X-Mimecast-MFC-AGG-ID: HPU2uTDDM3qhcyAoQRpNPQ_1794484026 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: berrange@redhat.com, arei.gonglei@huawei.com, zhenwei.pi@linux.dev, david@kernel.org, imammedo@redhat.com, jasowangio@gmail.com Subject: [PATCH] error: Improve a few error messages on setting property to zero Date: Thu, 12 Nov 2026 12:47:02 +0100 Message-ID: <20261112114702.969681-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.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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: 1794484072169158500 Error messages change from Property 'TYPE-NAME.PROP-NAME' doesn't take value '0' or similar to cannot set property 'PROP-NAME' of 'TYPE-NAME' to zero One of them is guarded by unsigned value <=3D 0. Use !value instead for clarity. Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 --- backends/cryptodev.c | 4 ++-- backends/hostmem-memfd.c | 4 ++-- backends/hostmem.c | 11 +++++------ net/dump.c | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 46059faa26c..585cc90890f 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -311,8 +311,8 @@ cryptodev_backend_set_queues(Object *obj, Visitor *v, c= onst char *name, return; } if (!value) { - error_setg(errp, "Property '%s.%s' doesn't take value '%" PRIu32 "= '", - object_get_typename(obj), name, value); + error_setg(errp, "cannot set property '%s' of '%s' to zero", + name, object_get_typename(obj)); return; } backend->conf.peers.queues =3D value; diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 46489212a23..0f5ab896192 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -143,8 +143,8 @@ memfd_backend_set_hugetlbsize(Object *obj, Visitor *v, = const char *name, return; } if (!value) { - error_setg(errp, "Property '%s.%s' doesn't take value '%" PRIu64 "= '", - object_get_typename(obj), name, value); + error_setg(errp, "cannot set property '%s' of '%s' to zero", + name, object_get_typename(obj)); return; } m->hugetlbsize =3D value; diff --git a/backends/hostmem.c b/backends/hostmem.c index 173d042be35..9e7450c67b7 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -76,9 +76,8 @@ host_memory_backend_set_size(Object *obj, Visitor *v, con= st char *name, return; } if (!value) { - error_setg(errp, - "property '%s' of %s doesn't take value '%" PRIu64 "'", - name, object_get_typename(obj), value); + error_setg(errp, "cannot set property '%s' of '%s' to zero", + name, object_get_typename(obj)); return; } backend->size =3D value; @@ -275,9 +274,9 @@ static void host_memory_backend_set_prealloc_threads(Ob= ject *obj, Visitor *v, if (!visit_type_uint32(v, name, &value, errp)) { return; } - if (value <=3D 0) { - error_setg(errp, "property '%s' of %s doesn't take value '%d'", na= me, - object_get_typename(obj), value); + if (!value) { + error_setg(errp, "cannot set property '%s' of '%s' to zero", + name, object_get_typename(obj)); return; } backend->prealloc_threads =3D value; diff --git a/net/dump.c b/net/dump.c index da366f48da7..52d94f101e6 100644 --- a/net/dump.c +++ b/net/dump.c @@ -199,8 +199,8 @@ static void filter_dump_set_maxlen(Object *obj, Visitor= *v, const char *name, return; } if (value =3D=3D 0) { - error_setg(errp, "Property '%s.%s' doesn't take value '%u'", - object_get_typename(obj), name, value); + error_setg(errp, "cannot set property '%s' of '%s' to zero", + name, object_get_typename(obj)); return; } nfds->maxlen =3D value; --=20 2.55.0