From nobody Fri May 17 18:59:21 2024 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=1662378804; cv=none; d=zohomail.com; s=zohoarc; b=k78HJR8lUn+kiX/E/v/IXNBwGEm/0U/svMVZjRpAMBOYJIiB3YfpUsX1pITzCxANF084fEFouHQP7YpSK5AYWxcZlNsq9IjPhyczE0a3/xZJ4ZiyJYYzUUbPjOxIyw+MEWKKNqX7mXsJE/Ixd2iI5jtEyfU6jkl/zB12LI5Lah8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662378804; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=uvn0kmiceqd2oyNCXiSyFlEG1+Z3hg5qC/XijQrII0Y=; b=LkkwJrTVogsu0jbUf7J5T+3lBWT2jOJHjJYCavo3hd5wGNBRhcQRJrlAH4fb3qfbrZrX1iq4EZMg77KsvwATt4dHdLAKtjpWW4DY53D83IT/rFxPnw2k7bD3DHlQAB3L700SDWGIPFT5noKC5l2wHwh0Z02JwcXgPjMT18ml+hY= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662378804760203.82690796382656; Mon, 5 Sep 2022 04:53:24 -0700 (PDT) Received: from localhost ([::1]:36798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVAfL-0006U0-Lk for importer@patchew.org; Mon, 05 Sep 2022 07:53:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVA0B-0005Mm-0x for qemu-devel@nongnu.org; Mon, 05 Sep 2022 07:10:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVA06-00065w-Vf for qemu-devel@nongnu.org; Mon, 05 Sep 2022 07:10:48 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-502-sgmlVqoiNhSUSVd2aopnsw-1; Mon, 05 Sep 2022 07:10:42 -0400 Received: by mail-ed1-f72.google.com with SMTP id r11-20020a05640251cb00b004484ec7e3a4so5629131edd.8 for ; Mon, 05 Sep 2022 04:10:41 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:2f4b:62da:3159:e077]) by smtp.gmail.com with ESMTPSA id g8-20020a50ee08000000b00447c646ad1asm6271233eds.57.2022.09.05.04.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 04:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662376245; 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=uvn0kmiceqd2oyNCXiSyFlEG1+Z3hg5qC/XijQrII0Y=; b=GRp1H8cMuXEvx2UaNxLtx5HGUG7ytbudzG/HEDx8vnTt9EwpzNHAvVUuCUpKepFlXNfYty 8BsJ2kcrf+Xod6wW1b3xC9Se+f48m5NC+xHixNQ8LUI/b8qOkeZ7U1xwT1IflN/Hs9f8pl eO8/yEwBPtYSF7LVUH2vDmvai3uSuiU= X-MC-Unique: sgmlVqoiNhSUSVd2aopnsw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=uvn0kmiceqd2oyNCXiSyFlEG1+Z3hg5qC/XijQrII0Y=; b=zFysmDrDBbzjnmHJGaJ3adaUxMwfCiXQSbEDwVjSlnqXvsOlMghlNY6G/LYO2InnWd Jq5kXKTGtpvRx/2rFiiBOanu9NnlTykEWfe4x87pjNWqxffgI2D1CySh9kNaVxeEHNCI UC8ExfKBak5NnO0244ruJ6B7DyoFLLBtH76RVjsLG44yYBDnsJGRsaASxx/HUgcWwxTM TLJSJhijf1QMb5f695dFnmoDGNbDy8SmbeapdqwHFu0pO3j80YTxl/lroF/lTehHoyJY uJ0zdZIgqiqlurOhr+Qkciune80mcinFjxbauK3h+z3M6lsHXwi1799z9/0bWT1iqOZR oaBg== X-Gm-Message-State: ACgBeo23PAiCcm+q7TQnjsL0/E4xAFz54tRFTxby3cEivn2QppV6lRcP XIPNfV4CsBPqcVuNWAQm6SJhtokBHOfol2DM5K05XCMUnVBbErFJ9uttNmvGeViW56R+pTCubE0 ZoOKEluRpTYfJBiU3sCAMiqS0kMoD9Cx3DBXIiwsag+cJGB4XJaqu6a6W3/RCqu7uRi0= X-Received: by 2002:a17:907:272a:b0:741:8105:49e2 with SMTP id d10-20020a170907272a00b00741810549e2mr25580560ejl.171.1662376240677; Mon, 05 Sep 2022 04:10:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR6nhLFTVzosOvnDxomhboUgPm9lirvcgFcQ/OXolY5WfaoxWT6h3S016WnTcLfgXWxs7daiYw== X-Received: by 2002:a17:907:272a:b0:741:8105:49e2 with SMTP id d10-20020a170907272a00b00741810549e2mr25580550ejl.171.1662376240432; Mon, 05 Sep 2022 04:10:40 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: armbru@redhat.com Subject: [PATCH] tests: unit: add NULL-pointer check Date: Mon, 5 Sep 2022 13:10:38 +0200 Message-Id: <20220905111038.33324-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 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=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1662378805589100001 Content-Type: text/plain; charset="utf-8" In CID 1432593, Coverity complains that the result of qdict_crumple() might leak if it is not a dictionary. This is not a practical concern since the test would fail immediately with a NULL pointer dereference in qdict_size(). However, it is not nice to depend on qdict_size() crashing, so add an explicit assertion that that the crumpled object was indeed a dictionary. Signed-off-by: Paolo Bonzini Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Markus Armbruster --- tests/unit/check-block-qdict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/check-block-qdict.c b/tests/unit/check-block-qdict.c index 5a25825093..751c58e737 100644 --- a/tests/unit/check-block-qdict.c +++ b/tests/unit/check-block-qdict.c @@ -504,7 +504,7 @@ static void qdict_crumple_test_empty(void) src =3D qdict_new(); =20 dst =3D qobject_to(QDict, qdict_crumple(src, &error_abort)); - + g_assert(dst); g_assert_cmpint(qdict_size(dst), =3D=3D, 0); =20 qobject_unref(src); --=20 2.37.2