From patchwork Sun Jan 31 10:36:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Iooss X-Patchwork-Id: 8173321 Return-Path: X-Original-To: patchwork-selinux@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8DB2F9FC36 for ; Sun, 31 Jan 2016 10:40:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EDBB0202FE for ; Sun, 31 Jan 2016 10:40:43 +0000 (UTC) Received: from emvm-gh1-uea09.nsa.gov (emvm-gh1-uea09.nsa.gov [63.239.67.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99E2C202F0 for ; Sun, 31 Jan 2016 10:40:42 +0000 (UTC) X-TM-IMSS-Message-ID: Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1) id dacfdd2200001286 ; Sun, 31 Jan 2016 05:40:46 -0500 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u0VAbLvY020327; Sun, 31 Jan 2016 05:37:30 -0500 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u0VAbKQI201492 for ; Sun, 31 Jan 2016 05:37:20 -0500 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u0VAbIJU020323 for ; Sun, 31 Jan 2016 05:37:20 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1BbAQCx4q1WnCIeaIFdGQEBAQEQAQIChEeIWK8kiG2DFgEBAQEBARIBAQEBAQgLCQkhhR2CI4gbBAGfU547hg+IN36DbgWWb5w7RI16ghgBCwF1gTVph0SBOQEBAQ X-IPAS-Result: A1BbAQCx4q1WnCIeaIFdGQEBAQEQAQIChEeIWK8kiG2DFgEBAQEBARIBAQEBAQgLCQkhhR2CI4gbBAGfU547hg+IN36DbgWWb5w7RI16ghgBCwF1gTVph0SBOQEBAQ X-IronPort-AV: E=Sophos;i="5.22,374,1449550800"; d="scan'208";a="5152295" Received: from emvm-gh1-uea08.nsa.gov ([10.208.42.193]) by goalie.tycho.ncsc.mil with ESMTP; 31 Jan 2016 05:37:17 -0500 X-TM-IMSS-Message-ID: <6e434c5e000073a0@nsa.gov> Received: from mx1.polytechnique.org (mx1.polytechnique.org [129.104.30.34]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 ADH-AES256-SHA (256/256)) id 6e434c5e000073a0 ; Sun, 31 Jan 2016 05:36:14 -0500 Received: from iosakhe.localdomain (32.206.133.77.rev.sfr.net [77.133.206.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 8B899564885 for ; Sun, 31 Jan 2016 11:37:13 +0100 (CET) From: Nicolas Iooss To: selinux@tycho.nsa.gov Subject: [PATCH 1/3] libsepol: cil: always initialize __cil_permx_to_sepol_class_perms() result Date: Sun, 31 Jan 2016 11:36:36 +0100 Message-Id: <1454236598-1829-1-git-send-email-nicolas.iooss@m4x.org> X-Mailer: git-send-email 2.7.0 X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sun Jan 31 11:37:13 2016 +0100 (CET)) X-Org-Mail: nicolas.iooss.2010@polytechnique.org X-TM-AS-MML: disable X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clang warns that __cil_permx_to_sepol_class_perms() return value, rc, may be unitialized: ../cil/src/cil_binary.c:4188:9: error: variable 'rc' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] return rc; ^~ ../cil/src/cil_binary.c:4148:8: note: initialize the variable 'rc' to silence this warning int rc; ^ = 0 This theoretically happens when cil_expand_class(permx->obj) returns an empty list. Signed-off-by: Nicolas Iooss --- libsepol/cil/src/cil_binary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsepol/cil/src/cil_binary.c b/libsepol/cil/src/cil_binary.c index 433f92e40a8e..47c751c0ef06 100644 --- a/libsepol/cil/src/cil_binary.c +++ b/libsepol/cil/src/cil_binary.c @@ -4145,7 +4145,7 @@ exit: static int __cil_permx_to_sepol_class_perms(policydb_t *pdb, struct cil_permissionx *permx, class_perm_node_t **sepol_class_perms) { - int rc; + int rc = SEPOL_OK; struct cil_list *class_list = NULL; struct cil_list_item *c; class_datum_t *sepol_obj = NULL;