From nobody Sun Feb 8 18:14:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585560336; cv=none; d=zohomail.com; s=zohoarc; b=WNGRSRXuQ2lnCFeMT0hcbtTP8z1HqjBZSfbTh3KLn/vHsUZCz1PyJSeFF+qGPyABUhjfDr/QyhbD0yTW5/lTCF2Ww9b1H50yBbI3ZXeNuFmmHXHHR5atgBPCzePm4t9K8BYMls7xnolxqjAk06y+XQXWAkEbsF0jWfynNMhk9zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585560336; h=Content-Type:Content-Transfer-Encoding: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=rjtojpPwmk3Wbu5kEbfqdWCkZXPZ89LTD7VlDTFlCQ8=; b=jPVpTSXsQlj38JwlZYUsezq0LYTD9jBoRawTxGqmnyxdlaEWkXW1woH8GrHbfvOBw2WkhpZtz/qD+N6ejHhzD2SlIOoV/vhudxXnd9UlnuTp9pqMIl9+jUTM6VIXve223lqWgn965GUqX54fQfLo4rz3s6KS7PYHq/DU9kk/CKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585560336261464.49631890891567; Mon, 30 Mar 2020 02:25:36 -0700 (PDT) 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-16-vv-5R1WdNx-xyuFypZ0wKw-1; Mon, 30 Mar 2020 05:25:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2224118A5500; Mon, 30 Mar 2020 09:25:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9FA360BE2; Mon, 30 Mar 2020 09:25:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9BCB5944D6; Mon, 30 Mar 2020 09:25:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02U9PAei004082 for ; Mon, 30 Mar 2020 05:25:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2BC08D767B; Mon, 30 Mar 2020 09:25:10 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C7CED7678 for ; Mon, 30 Mar 2020 09:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585560335; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rjtojpPwmk3Wbu5kEbfqdWCkZXPZ89LTD7VlDTFlCQ8=; b=YB5QYTwMirGc+dPHDr0f/88AMtcAaoF1cljnttZMXBtfFF00mWP3vBxLEJ6882iUO4utjK RMPH8Mq/B/nBw5LpM1YhJlmWrqe0MWXbiE1LQkFdjVv5NHepqp0gAqu08QLjN7gUz+gu7e 0EW44xxWjKKAWQ7KSjEI1FRYGeV6WQw= X-MC-Unique: vv-5R1WdNx-xyuFypZ0wKw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] virSecurityDeviceLabelDefNew: Avoid NULL dereference Date: Mon, 30 Mar 2020 11:25:00 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" While it is impossible for VIR_ALLOC() to return an error, we should be consistent with the rest of the code and not continue initializing the virSecurityDeviceLabelDef structure. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/util/virseclabel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virseclabel.c b/src/util/virseclabel.c index a2b5ebf6b7..2141d84210 100644 --- a/src/util/virseclabel.c +++ b/src/util/virseclabel.c @@ -77,7 +77,7 @@ virSecurityDeviceLabelDefNew(const char *model) =20 if (VIR_ALLOC(seclabel) < 0) { virSecurityDeviceLabelDefFree(seclabel); - seclabel =3D NULL; + return NULL; } =20 seclabel->model =3D g_strdup(model); --=20 2.24.1