From nobody Fri May 10 14:36:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621506509; cv=none; d=zohomail.com; s=zohoarc; b=ccIiZff/4PgorC/KK9hfkHD6tg0XNx5jsvBkkXD46+XeYa+LuP5DEevB3eIdoiOQb1S35jc8aIiHHN6lHUJaLCeJUI8sWplopx9pQLk4vpWZru+6cnBxGjpeW5F9zrOVaHc4tCVSXoAQWivvRiLKm3jEwIWxClRfHSXmx5AKKPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621506509; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=JrlLAe6nBxkVBR65Wf9lezvd2U0ROpbs621C1+5lu2g=; b=aG5uohFhBy8XlJLP/vTd+shzkAwc8wtRbTUKFkhTNNji3WeoC2u6aX9tLbNcv8/IEkh2Bt4l8bIDtZGJqDGhmOXyGSQs1IY/HuW+sVvY1AxDd0KEWpgkRmXwCTGh8pEEKwuuVdTwLA8bnGxSz6fmKW1gQDbWhZXJHLmVJNQ+HiE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621506509421503.29877170890006; Thu, 20 May 2021 03:28:29 -0700 (PDT) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-R5yJdoDZMza_0LO8n-FTvQ-1; Thu, 20 May 2021 06:28:26 -0400 Received: by mail-ed1-f71.google.com with SMTP id x3-20020a50ba830000b029038caed0dd2eso9322194ede.7 for ; Thu, 20 May 2021 03:28:26 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id gu16sm1128901ejb.88.2021.05.20.03.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 03:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621506507; 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=JrlLAe6nBxkVBR65Wf9lezvd2U0ROpbs621C1+5lu2g=; b=Oi4cvSR1CfMqzkJn+KFaML95dyqBSlPZuiWltfYMp3sK0NTKEUlZMhZJa9XRmLXz10TeET rCox1Puh+1ptuf4bryMrGLZFIGXCIRtz5JoS7KaaH78wdOvMsETN5RHk28E/VS67/8+6SN BZK9kTol6gpCtxebmZQ6p023/vKyuGo= X-MC-Unique: R5yJdoDZMza_0LO8n-FTvQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JrlLAe6nBxkVBR65Wf9lezvd2U0ROpbs621C1+5lu2g=; b=PBerr3sISpWmauhcXO3YpLSRRxMmVlA5IEJV7lITZHk8jmPfhw1voYnzGl1MUWdqKm zFmt2PFpOdzqVrZXptfa3aMiNHJo5lptgVx/Br714opFhoejgDMbFwxcYsfNJVm7LXmO 9GnjD4tfcVI3ko3U4ZH+Ni9g6bWXE1S12uLTrxshAoTQ9PYWBji2QwkfwuJbYqmPxnVz U+mc5ujexQTOdQlUFGKEiDln4kep5GypW6tz/0kw68mvfTlRueodP4Gj1x3lgrkRpUxt Y9BuVz+S2c4q/q9UWjZQpz6EqHf8Rb1mVt51jgSNguh4ss3GoWvH3RdT4yAjbjLatV6v rrQQ== X-Gm-Message-State: AOAM5328Td2g/8sK9CCHJjIPvfLDOUFgUS8euqrexWA0LItfUwx8HKsB XoMBy3IrmIIwrXAUQoS1IRoMPkvhXgIPvTKE5EG8Qyyfe4Sd9OQWnRGts/GyDhigykxNv+VeTo7 pnsArRGFJIBFVTQ== X-Received: by 2002:a17:906:6549:: with SMTP id u9mr3880105ejn.506.1621506505001; Thu, 20 May 2021 03:28:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlOVio4jzWoqi8Q77vA6zQEP50AmmaL5gfrZwdIZb6KpWqNkrafX1BEwINCANtb/iZzXOlww== X-Received: by 2002:a17:906:6549:: with SMTP id u9mr3880061ejn.506.1621506504387; Thu, 20 May 2021 03:28:24 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Frederic Konrad , Gerd Hoffmann , Jason Wang , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH] hw/virtio: Have virtio_bus_get_vdev_bad_features() return 64-bit value Date: Thu, 20 May 2021 12:28:22 +0200 Message-Id: <20210520102822.2471710-1-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) In commit 019a3edbb25 ("virtio: make features 64bit wide") we increased the 'features' field to 64-bit, but forgot to update the virtio_bus_get_vdev_bad_features() helper. The 'bad features' are truncated to 32-bit. The virtio_net_bad_features() handler from the virtio-net devices is potentially affected. Have the virtio_bus_get_vdev_bad_features() helper return the full 64-bit value. Cc: qemu-stable@nongnu.org Fixes: 019a3edbb25 ("virtio: make features 64bit wide") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Cornelia Huck --- include/hw/virtio/virtio-bus.h | 2 +- hw/virtio/virtio-bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h index ef8abe49c5a..f9955ff577a 100644 --- a/include/hw/virtio/virtio-bus.h +++ b/include/hw/virtio/virtio-bus.h @@ -122,7 +122,7 @@ uint16_t virtio_bus_get_vdev_id(VirtioBusState *bus); /* Get the config_len field of the plugged device. */ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus); /* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus); +uint64_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus); /* Get config of the plugged device. */ void virtio_bus_get_vdev_config(VirtioBusState *bus, uint8_t *config); /* Set config of the plugged device. */ diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index 859978d2487..25a2b68a234 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -134,7 +134,7 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *b= us) } =20 /* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus) +uint64_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus) { VirtIODevice *vdev =3D virtio_bus_get_device(bus); VirtioDeviceClass *k; --=20 2.26.3