From nobody Fri Apr 26 23:13:40 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=libvir-list-bounces@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=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1641562792; cv=none; d=zohomail.com; s=zohoarc; b=cQR7+ifhvArfO7caLReUCtiRbYl7nOl3phCgkWMg9orHme80miHe+hez9Y5SuL9uNpWPMCvDeU7YKET3SZleYHn2/2xjP00R8Et3+YpCwAvxdk1Cuk+szwoLYAZZ9ImKdd+rKNizgXFy1/GlQMJIIM/GTSWwiG/BpQu7gf5zwUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641562792; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=3kcCtgJ9Oc6f8yV7m+EUPHRcQtQr3PDU+pm1rWVKqas=; b=ZYYwFFk7f20ggs6NABxQWk/6nm8js/fxZv8Lx+hGycOlR9KMq58S15NvwUZMIkw8hgTKFj7Ihnsmr1G7k72kb7RAgVoGpXT3ZRss0gnjbTVlCoVFtQa6VwvMNT5w34aDrOg+Y3GuLLFwNRHThIwDAFoO1CQgPqr66HAU2rRHABE= 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=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: 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 1641562792193910.6499782501061; Fri, 7 Jan 2022 05:39:52 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-148-PJq9YvWMMDeWixxJi0AIug-1; Fri, 07 Jan 2022 08:39:49 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0F16760C1; Fri, 7 Jan 2022 13:39:43 +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 ECDFB7E66B; Fri, 7 Jan 2022 13:39:40 +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 B3B634BB7C; Fri, 7 Jan 2022 13:39:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 207DdZhE028687 for ; Fri, 7 Jan 2022 08:39:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F29484D38; Fri, 7 Jan 2022 13:39:35 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDA3B84D3E for ; Fri, 7 Jan 2022 13:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641562791; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3kcCtgJ9Oc6f8yV7m+EUPHRcQtQr3PDU+pm1rWVKqas=; b=VcJuL/YbipamkqGSHD/4Mpb+OBzNd1SUefSaXWwC1MqgIpMlFCImOfadYx+K7EfV21MjkY EFu7jHiszHq601413cxZBXtmOBanf02tiM2tePSIZPlFZ9Xv7RqCrVuTew/0Icbk2pqy0O UoOm/tX6mWN/eEbUbq7Uklf0PcZCcvQ= X-MC-Unique: PJq9YvWMMDeWixxJi0AIug-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] src: Don't check for retval of g_strsplit() Date: Fri, 7 Jan 2022 14:39:17 +0100 Message-Id: <00fe029fdaa881a011391b65172a975fed935c9a.1641562757.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1641562793354100001 Content-Type: text/plain; charset="utf-8" The g_strsplit() function can return NULL if and only if either the input string is NULL or delimiter is NULL or an empty string. In neither of places we call it any of the conditions is true and thus we don't need to check for the return value. Signed-off-by: Michal Privoznik --- src/libxl/xen_xl.c | 2 -- src/util/vircgroupv2.c | 2 -- src/util/virprocess.c | 2 -- src/util/virresctrl.c | 2 -- 4 files changed, 8 deletions(-) diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 7604e3d534..869083a1d1 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -265,8 +265,6 @@ xenParseXLCPUID(virConf *conf, virDomainDef *def) } =20 cpuid_pairs =3D g_strsplit(cpuid_str, ",", 0); - if (!cpuid_pairs) - return -1; =20 if (!cpuid_pairs[0]) return 0; diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 4c110940cf..f00a8f154b 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -286,8 +286,6 @@ virCgroupV2ParseControllersFile(virCgroup *group, virTrimSpaces(contStr, NULL); =20 contList =3D g_strsplit(contStr, " ", 20); - if (!contList) - return -1; =20 tmp =3D contList; =20 diff --git a/src/util/virprocess.c b/src/util/virprocess.c index b559a4257e..06767dbf51 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -1837,8 +1837,6 @@ virProcessGetSchedInfo(unsigned long long *cpuWait, return -1; =20 lines =3D g_strsplit(data, "\n", 0); - if (!lines) - return -1; =20 for (i =3D 0; lines[i] !=3D NULL; i++) { const char *line =3D lines[i]; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index edbf078654..fe45ad3c64 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -1646,8 +1646,6 @@ virResctrlAllocParseCacheLine(virResctrlInfo *resctrl, } =20 caches =3D g_strsplit(tmp, ";", 0); - if (!caches) - return 0; =20 for (next =3D caches; *next; next++) { if (virResctrlAllocParseProcessCache(resctrl, alloc, level, type, = *next) < 0) --=20 2.34.1