From nobody Fri Apr 26 09:03:44 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541445682941205.85591283059136; Mon, 5 Nov 2018 11:21:22 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 67B073082A36; Mon, 5 Nov 2018 19:21:20 +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 778745D73F; Mon, 5 Nov 2018 19:21:19 +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 BCE514BB79; Mon, 5 Nov 2018 19:21:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wA5IwYw4029737 for ; Mon, 5 Nov 2018 13:58:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1F0C719751; Mon, 5 Nov 2018 18:58:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1615B194B4 for ; Mon, 5 Nov 2018 18:58:31 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3A6A307D85E for ; Mon, 5 Nov 2018 18:58:30 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id r71so16663320qkr.10 for ; Mon, 05 Nov 2018 10:58:30 -0800 (PST) Received: from localhost.localdomain ([177.45.6.151]) by smtp.gmail.com with ESMTPSA id r142sm3754495qke.27.2018.11.05.10.58.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 10:58:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=53yyKL+ZhDHQOa1TYemyzyhQ6sht6A5L70QB3C0SED8=; b=QgaWDhImW7I/W40zBWJPqg9mwawIKnN2bHkhuwEWWaSQq8xvWCD5GAn6g2JQko5w2m 9hLfnI2u2v8FB5le5DXjjiwV7OfH4zTESPkUwVXwcbbJEcJ1M5S8EOBKtWe5g+z0wCUp mQxhI33TOnT3IYuVtZnEPSRWIgEi4k/EbsvV+Am3qdmXy/wIATtOAuhrvuI45Bl/hGt6 ylCdkapLdYSBFLYwFnSPMiCJYRzY7oBIscOMQgTrkOO0uu/JFDPURg4rmQHd0SzeuYbn +pwGDDSyPtb6suwjumQogiy4A59CHx0F+/KzPb52AJrPiqHMFnkv+iPPvjN189ckpb08 +McA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=53yyKL+ZhDHQOa1TYemyzyhQ6sht6A5L70QB3C0SED8=; b=bynNi6FDUEbAHGVpis8TWH3dmpnUfVwHS09Yakq7SMo+fVe0twqhFGFjnGEAOv1oMZ NuzacnRJQMjbpvhR8Z3uSuEQUccBiUM+VWgugVaesNRP9dkM720BvfF3VHzVhzvnPTJw 7+kCrtj0aUvvId/wswDXq/KuKZscja7VGeuIvAJeRQ9RD/HeoN96Igsx9ROYzvu08ZTl 6yw0uJSpDaeuppO9JgQB+Dd4evd/NPkKazrHak1nTmezPKvHH6Kz+hQi5+6c8XDMWUjf KjxlEB+v635tP/KVAf4FHjwmOYqLio/EUuyjf+Fv1dEOWCeqYuoV/2wzzXn0Fcdbl4AS SJRQ== X-Gm-Message-State: AGRZ1gJmlOvU0M+zvIed+dd8d3Ug9tsTnLKoPKT+3xNEintFB6fssvzL gIVXShJJ16PZmDzEHM80p3u7Cfbi X-Google-Smtp-Source: AJdET5d6DLF0/TqINtCCstCGqGPpCHIBK71Ymr9lgyQMZsC/PuqupPodQwwZg5s727afl/UeD47WKw== X-Received: by 2002:ac8:1096:: with SMTP id a22-v6mr22125080qtj.359.1541444309583; Mon, 05 Nov 2018 10:58:29 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Date: Mon, 5 Nov 2018 16:58:14 -0200 Message-Id: <20181105185814.31493-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 05 Nov 2018 18:58:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 05 Nov 2018 18:58:30 +0000 (UTC) for IP:'209.85.222.193' DOMAIN:'mail-qk1-f193.google.com' HELO:'mail-qk1-f193.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.222.193 mail-qk1-f193.google.com 209.85.222.193 mail-qk1-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] lxc: Clang is complaining about possible NULL pointer. 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 05 Nov 2018 19:21:21 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The array "mount" inside lxc_container is not being checked before for loop. Clang syntax scan is complaining about this segmentation fault. Signed-off-by: Julio Faracco --- src/lxc/lxc_container.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 918194dacd..6b7bcd8eb6 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -871,7 +871,7 @@ static int lxcContainerSetReadOnly(void) qsort(mounts, nmounts, sizeof(mounts[0]), virStringSortRevCompare); =20 - for (i =3D 0; i < nmounts; i++) { + for (i =3D 0; i < nmounts && mounts; i++) { VIR_DEBUG("Bind readonly %s", mounts[i]); if (mount(mounts[i], mounts[i], "none", MS_BIND|MS_REC|MS_RDONLY|M= S_REMOUNT, NULL) < 0) { virReportSystemError(errno, @@ -883,7 +883,7 @@ static int lxcContainerSetReadOnly(void) =20 ret =3D 0; cleanup: - for (i =3D 0; i < nmounts; i++) + for (i =3D 0; i < nmounts && mounts; i++) VIR_FREE(mounts[i]); VIR_FREE(mounts); endmntent(procmnt); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list