From nobody Mon Feb 9 04:45:37 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604510915; cv=none; d=zohomail.com; s=zohoarc; b=TPM+4obKW58WaUi3Kc/IoQjfmzF0yAo9KquOe5O8uJXf1FjyjbDkoH9WS9ErIkfqxa6hEktBJjIHiixsg6ADClc4B/dZywuHB6pRovLmzq2NHqMVNN0hxfkbooZpMvqZ+vt2M2FUSjpdOvuyhavv8cI6VWhN4JqwyhJEiD8NvnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604510915; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/E/VfVeQ6SgwgOxmEY2GWK/9ySHK0Bx88fxijhLB0l0=; b=IAVNUv58/gy29q/OEVcj13Z9K6AI7HhwKDHW9ROIMZqD91gGNerGYa4kQ61CahksPUf2AGx6YXActW96RIVDFJAKlj0Pd8/mMGja7arCXXomEq8AHTlmPBjTiRPNkSTd5HGBgVDUVp/GKbj48NXQkJesO211GTlZR073Gji3c8Q= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604510915906264.4466673631765; Wed, 4 Nov 2020 09:28:35 -0800 (PST) Received: from localhost ([::1]:58398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaMaI-0005mF-QK for importer@patchew.org; Wed, 04 Nov 2020 12:28:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaMXF-0000zM-75 for qemu-devel@nongnu.org; Wed, 04 Nov 2020 12:25:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kaMXC-0008CT-RF for qemu-devel@nongnu.org; Wed, 04 Nov 2020 12:25:24 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-l_nZfuNiNhqSezBQijiOiA-1; Wed, 04 Nov 2020 12:25:20 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 156FE18A6280 for ; Wed, 4 Nov 2020 17:25:19 +0000 (UTC) Received: from localhost (ovpn-114-68.rdu2.redhat.com [10.10.114.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id A79005D98F; Wed, 4 Nov 2020 17:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604510721; 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=/E/VfVeQ6SgwgOxmEY2GWK/9ySHK0Bx88fxijhLB0l0=; b=c2EWaOYVEsySGCUAo7q5WSULwR3iaKDeA7V5V/dOU4fbXc5b6YqEPnhcJodn54hbkRTr5B RBoKXy6cwH8TdPclRj+bV3kthoqFf6YlozpU4YYGDyviF8rWI2XfKVyTfc62MIVkYSqc8m B82Tkk53MkujCcWQOFwYlVaiwB6ufB0= X-MC-Unique: l_nZfuNiNhqSezBQijiOiA-1 From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 3/7] qdev: Don't register unreadable legacy properties Date: Wed, 4 Nov 2020 12:25:08 -0500 Message-Id: <20201104172512.2381656-4-ehabkost@redhat.com> In-Reply-To: <20201104172512.2381656-1-ehabkost@redhat.com> References: <20201104172512.2381656-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/03 22:09:52 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , "Daniel P. Berrange" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) The existing code at qdev_class_add_legacy_property() will register a property if both .print and .get are NULL, which is useless as it will register a property that can't be read or written. The only PropertyInfo struct in the whole tree that has both .print and .get set to NULL is qdev_prop_link. This means every link property in the code had a useless "legacy-" property being registered. Fix this by only registering legacy properties if a .print method exists. Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrang=C3=A9" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 5bb4ff5f46..73884a212a 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -264,13 +264,13 @@ static void qdev_class_add_legacy_property(DeviceClas= s *dc, Property *prop) g_autofree char *name =3D NULL; =20 /* Register pointer properties as legacy properties */ - if (!prop->info->print && prop->info->get) { + if (!prop->info->print) { return; } =20 name =3D g_strdup_printf("legacy-%s", prop->qdev_prop_name); object_class_property_add(OBJECT_CLASS(dc), name, "str", - prop->info->print ? qdev_get_legacy_property : prop->info->get, + qdev_get_legacy_property, NULL, NULL, prop); } =20 --=20 2.28.0