From nobody Sun May 5 02:48:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547818933203768.4198569271031; Fri, 18 Jan 2019 05:42:13 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C95B02CD7F3; Fri, 18 Jan 2019 13:42:10 +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 025771001F50; Fri, 18 Jan 2019 13:42:10 +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 28E323F7CD; Fri, 18 Jan 2019 13:42:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0I7nsIb029317 for ; Fri, 18 Jan 2019 02:49:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9CD735D736; Fri, 18 Jan 2019 07:49:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9640D5D6AA for ; Fri, 18 Jan 2019 07:49:52 +0000 (UTC) Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C610E7D0DF for ; Fri, 18 Jan 2019 07:49:50 +0000 (UTC) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 34E9B4CB5F99354106EA for ; Fri, 18 Jan 2019 15:49:48 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x0I7ng0v008817 for ; Fri, 18 Jan 2019 15:49:42 +0800 (GMT-8) (envelope-from cheng.lin130@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019011815502023-22954916 ; Fri, 18 Jan 2019 15:50:20 +0800 From: Cheng Lin To: libvir-list@redhat.com Date: Fri, 18 Jan 2019 15:49:37 +0800 Message-Id: <1547797777-4749-1-git-send-email-cheng.lin130@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-01-18 15:50:20, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-01-18 15:49:27, Serialize complete at 2019-01-18 15:49:27 X-MAIL: mse01.zte.com.cn x0I7ng0v008817 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Jan 2019 07:49:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Jan 2019 07:49:51 +0000 (UTC) for IP:'202.103.147.172' DOMAIN:'out1.zte.com.cn' HELO:'mxct.zte.com.cn' FROM:'cheng.lin130@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 202.103.147.172 out1.zte.com.cn 202.103.147.172 out1.zte.com.cn X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 18 Jan 2019 08:42:08 -0500 Cc: wang.yi59@zte.com.cn, Cheng Lin , xue.zhihong@zte.com.cn Subject: [libvirt] [PATCH] conf: Add check to avoid a NULL compare for SysfsPath 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 18 Jan 2019 13:42:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If the two sysfs_path are both NULL, there may be an incorrect object returned for virNodeDeviceObjListFindBySysfsPath(). This check exists in old interface virNodeDeviceFindBySysfsPath(). e.g. virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs, const char *sysfs_path) { ... if ((devs->objs[i]->def->sysfs_path !=3D NULL) && (STREQ(devs->objs[i]->def->sysfs_path, sysfs_path))) { ... } Signed-off-by: Cheng Lin --- src/conf/virnodedeviceobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index c8ad131..2e40de5 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -207,7 +207,8 @@ virNodeDeviceObjListFindBySysfsPathCallback(const void = *payload, int want =3D 0; =20 virObjectLock(obj); - if (STREQ_NULLABLE(obj->def->sysfs_path, sysfs_path)) + if ((obj->def->sysfs_path !=3D NULL) && + (STREQ_NULLABLE(obj->def->sysfs_path, sysfs_path))) want =3D 1; virObjectUnlock(obj); return want; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list