From nobody Sun Feb 8 12:37:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1597327482; cv=none; d=zohomail.com; s=zohoarc; b=ni9S5EQkKhe9nkNSxBCq9S31OcIQsTiWspnAS0WQ86wWeb2Vg8IxzGkyYyKWRinjGDDrcYHTGTPPp/3M3DkRmEpbEJicuGffRCrCKrbZaIhYU34teEbRv2r2oEVAih5euH2rg3V981y61XrStQECMfabfkYCzRKid3gcqHvxnZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597327482; h=Content-Type:Content-Transfer-Encoding:Cc: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=+urRYcnQL8hsfRK6Fnq9VGD2cFvFXXe4fgbyKzWbp34=; b=kFtRYKxSMRi1/DmfXjT6G5yPTsKkXMSV7VbDeT+3nYHyP7mIkk3wilJ0tqK1Nv5ieT/yfbLYBzmq56UYOLMyQF8mb9yp8Rfi7XCYmgWtS0UCICexoIgMQKnkbY/59ifOpMZZvv+x3qQY6FbmR/ayU6j4L56n8asyBI9i69BAnrk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1597327482061878.6223218494056; Thu, 13 Aug 2020 07:04:42 -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-430-enQz5sQIPeyZBxtXpvKQ2Q-1; Thu, 13 Aug 2020 10:04:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC616425CB; Thu, 13 Aug 2020 14:04:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF99162A27; Thu, 13 Aug 2020 14:04:28 +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 8E9D9181A870; Thu, 13 Aug 2020 14:04:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07DE45a1017413 for ; Thu, 13 Aug 2020 10:04:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 20C2D2166B44; Thu, 13 Aug 2020 14:04:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C18F2166BA0 for ; Thu, 13 Aug 2020 14:04:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6E9FA804C9D for ; Thu, 13 Aug 2020 14:04:03 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-q8TACZXSMh-75d47n01OdA-1; Thu, 13 Aug 2020 10:04:00 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07DE2Z63014261 for ; Thu, 13 Aug 2020 10:03:59 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 32w0nhk4sy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 13 Aug 2020 10:03:58 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07DE0W1C008450 for ; Thu, 13 Aug 2020 14:03:56 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 32skp85mja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 13 Aug 2020 14:03:55 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07DE3rZm22675850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Aug 2020 14:03:53 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02D8942049; Thu, 13 Aug 2020 14:03:53 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D75F64204B; Thu, 13 Aug 2020 14:03:52 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.171.229]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 13 Aug 2020 14:03:52 +0000 (GMT) X-MC-Unique: enQz5sQIPeyZBxtXpvKQ2Q-1 X-MC-Unique: q8TACZXSMh-75d47n01OdA-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 2/3] tools: avoid potential null pointer dereference by GCC 10 Date: Thu, 13 Aug 2020 16:03:45 +0200 Message-Id: <20200813140346.4284-3-fiuczy@linux.ibm.com> In-Reply-To: <20200813140346.4284-1-fiuczy@linux.ibm.com> References: <20200813140346.4284-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-13_11:2020-08-13, 2020-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 suspectscore=1 malwarescore=0 adultscore=0 bulkscore=0 mlxlogscore=860 phishscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008130102 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-001b2d01.pphosted.com id 07DE2Z63014261 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 07DE45a1017413 X-loop: libvir-list@redhat.com Cc: mhartmay@linux.ibm.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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable GCC 10 complains about "arg" possibly being a NULL dereference. Even though it might be a false positive, we can easily avoid it. Avoiding ../tools/vsh.c: In function =E2=80=98vshCommandOptStringReq=E2=80=99: ../tools/vsh.c:1034:19: error: potential null pointer dereference [-Werror= =3Dnull-dereference] 1034 | else if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK= )) | ~~~^~~~~~ Signed-off-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer --- tools/vsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index 5e2e3ac219..11f493f969 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1031,7 +1031,7 @@ vshCommandOptStringReq(vshControl *ctl, /* this should not be propagated here, just to be sure */ if (ret =3D=3D -1) error =3D N_("Mandatory option not present"); - else if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK)) + else if (arg && !*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK)) error =3D N_("Option argument is empty"); =20 if (error) { --=20 2.25.1