From nobody Tue Feb 10 05:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630792107025201.44724113007965; Sat, 4 Sep 2021 14:48:27 -0700 (PDT) Received: from localhost ([::1]:49074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMdWT-0001Yj-Nq for importer@patchew.org; Sat, 04 Sep 2021 17:48:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMdLX-0005tO-79 for qemu-devel@nongnu.org; Sat, 04 Sep 2021 17:37:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33522) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMdLV-0001NA-Q5 for qemu-devel@nongnu.org; Sat, 04 Sep 2021 17:37:06 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-232-MeWG8XIMNWSR_znHPDjJLA-1; Sat, 04 Sep 2021 17:37:04 -0400 Received: by mail-ed1-f70.google.com with SMTP id j13-20020aa7ca4d000000b003c44c679d73so1501771edt.8 for ; Sat, 04 Sep 2021 14:37:04 -0700 (PDT) Received: from redhat.com ([2.55.150.176]) by smtp.gmail.com with ESMTPSA id b18sm1518651ejl.90.2021.09.04.14.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Sep 2021 14:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630791425; 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=DKUyiG5ulvlN8bn9hYjVPeiz0laMQTjL5M3rAODT118=; b=dl8JpKL4mE5h/M5doK4y4NGDXT3WbXkX+nuXrH/YJ7Zo/yWIzu0PkD5no7gqEYEtSH4EdV TME5hgvo6lgQSuPKzITFmSQbppu5oiP60axF9FlzNGqiMsie1UcNagwy4eNHd+EAg3Wj0D NaSUklycur3lso/g27e3CGvPkndkC38= X-MC-Unique: MeWG8XIMNWSR_znHPDjJLA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=DKUyiG5ulvlN8bn9hYjVPeiz0laMQTjL5M3rAODT118=; b=FTJkVwav7jbH6OB+87VUFOltDtyTn/+qbPLrub5nCUYe51VUP+4QdKw2+J+hCM7t8I vncshvOQOoFybDQA/1tjBi+8nGvtxtjmqfu0J+B/9sY4EdIbqPwOFw4PIqKPwfQF8Bkt 5VtiWrI5bQmR9vtLR7DT+7rgGurxcx1u4GTOTlzzxsuYzu7Gy63pgPXJkNICvVkeC/97 6TWNtZJrG5PSA6VBcUvkLh92+D0KxcEKz0SEUDi0erUDkXsvCWsMw5EW4/sR6SzlFIFy ArDeY/94Sdm/4sQp8WLY60FiVbYD50KInhOZmat4WIhM9PnmPLWGWrYjqOzGY3x3DTVS Rqqw== X-Gm-Message-State: AOAM530KUV6YiTinPTGuhgkR5lKyTe0pD3SlooocZuGLLWCzdcSuGdXX BxqJVHdkZvC/NqTjGoQ8SiMLduxdx3tilrxpR58dwznHD7iUAc9qIG0KXupdyyZs1KWXMThhCKx gMt0kxPibyFlAjy0TVlDQmLYKHQHyNguV5+aeHxxUsZbWCPrTtx07nSTOZXQt X-Received: by 2002:a17:906:9ac5:: with SMTP id ah5mr6005557ejc.224.1630791422654; Sat, 04 Sep 2021 14:37:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZs/laeXpFr0DvoDT3/miKSIDRJomlYg+fsr4RJXQCglVMqwYI3lt9JvRkPTYVZvEDt9WeGw== X-Received: by 2002:a17:906:9ac5:: with SMTP id ah5mr6005540ejc.224.1630791422469; Sat, 04 Sep 2021 14:37:02 -0700 (PDT) Date: Sat, 4 Sep 2021 17:37:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 21/35] hw/virtio: Remove NULL check in virtio_free_region_cache() Message-ID: <20210904213506.486886-22-mst@redhat.com> References: <20210904213506.486886-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210904213506.486886-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline 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=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, 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_H2=-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: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1630792108432100001 From: Philippe Mathieu-Daud=C3=A9 virtio_free_region_cache() is called within call_rcu(), always with a non-NULL argument. Ensure new code keep it that way by replacing the NULL check by an assertion. Add a comment this function is called within call_rcu(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210826172658.2116840-3-philmd@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi --- hw/virtio/virtio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index a5214bca61..3a1f6c520c 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -133,12 +133,10 @@ struct VirtQueue QLIST_ENTRY(VirtQueue) node; }; =20 +/* Called within call_rcu(). */ static void virtio_free_region_cache(VRingMemoryRegionCaches *caches) { - if (!caches) { - return; - } - + assert(caches !=3D NULL); address_space_cache_destroy(&caches->desc); address_space_cache_destroy(&caches->avail); address_space_cache_destroy(&caches->used); --=20 MST