Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp367671pxa; Wed, 19 Aug 2020 03:44:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx27Ei/oSvUytGTYYrg9/Cyaz4/ff13EEQmLztyv3Ktn1cfzZSnFDBxEWZUGcMb4Rkgmnse X-Received: by 2002:a17:906:3790:: with SMTP id n16mr24295125ejc.256.1597833873967; Wed, 19 Aug 2020 03:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597833873; cv=none; d=google.com; s=arc-20160816; b=KvUO2NKe0RVgIEsmCBZHC1BzrJDRyPb0vVUgJ2vBt5R9s7LZYpeYWTdyVZmess/aYB ke4hTgzbPJXWxEghWFdhQyxtk1a8xbQunZKC+u2HsqgChqaPiJzwuMWPGDrkGSAnPO3D 788Avq3SJSLzN5TppC6ItWlQ90GZzCRaJqlclIlKeZGusKtKrZ/iT0ww2ki15e9qmkcH EzJqYuGhx5QnfPgmBZ5WoNY8RH3n7X5SlaStUsA+Rys/SYbSG0Lnjq/5YHLW2XzK24W6 etHOyEl8X7Hevy6TFDOZWFxndxWsHMvz36SAPLhQgdIDBmlC1PY/TMSh7oqbj+MKyXJW ACcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Cvuc2d8tjg0Vt4c+CfVDx+CpAvYUiri7uo7XqjxiszY=; b=viEWIg2G2fJlAkYewaebnvkqUTaYuJBAYNJzMgbtg8drmrRdjfblCyepGLF2+xW+Jo dASV7ipkwgvmC+9WkCl4nG/vFKaeWlaMD/W+Uy2qH6or+JsAsQtXF7MuxFdb4VSMQi0k UU62vG4Vma1/se/Rs7UgyQVtH4GCOrkBpJ0VRUol4cwObmLAfyBmeaqOGcDj6BX/kyoo 3P85Ua73eirS8UsFHSkaJr2uOmvEowVulSwuPt7sGWqkK/CIOscDYl8g0+XzGVD/Z2G7 xys3RLnG12KtL7TwLKWWX1xvm32Gshkj5BjqVbUtVwNfo6JF7CgwTYBvUO7yjJilgRWL yaog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si15462116ejt.242.2020.08.19.03.44.10; Wed, 19 Aug 2020 03:44:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727994AbgHSKnB (ORCPT + 99 others); Wed, 19 Aug 2020 06:43:01 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:53838 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbgHSKnA (ORCPT ); Wed, 19 Aug 2020 06:43:00 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k8LYX-0005jD-3p; Wed, 19 Aug 2020 10:42:57 +0000 From: Colin King To: Paul Moore , Stephen Smalley , Eric Paris , Ondrej Mosnacek , selinux@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab Date: Wed, 19 Aug 2020 11:42:56 +0100 Message-Id: <20200819104256.51499-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The allocation check of newpolicy->sidtab is null checking if newpolicy is null and not newpolicy->sidtab. Fix this. Addresses-Coverity: ("Logically dead code") Fixes: c7c556f1e81b ("selinux: refactor changing booleans") Signed-off-by: Colin Ian King --- security/selinux/ss/services.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index f6f78c65f53f..d310910fb639 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -2224,7 +2224,7 @@ int security_load_policy(struct selinux_state *state, void *data, size_t len, return -ENOMEM; newpolicy->sidtab = kzalloc(sizeof(*newpolicy->sidtab), GFP_KERNEL); - if (!newpolicy) + if (!newpolicy->sidtab) goto err; rc = policydb_read(&newpolicy->policydb, fp); -- 2.27.0