Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp423357pxa; Wed, 19 Aug 2020 05:25:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbtSBcgvLMUTw71erV+cy7tb+YhCjvR2W7ecnFLyOU5W0N6HWIYSYnTFGZAUC9DgMUbZTV X-Received: by 2002:a17:906:b110:: with SMTP id u16mr24349845ejy.483.1597839921323; Wed, 19 Aug 2020 05:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597839921; cv=none; d=google.com; s=arc-20160816; b=jJ+qwDHUClle4/QGulh5BWVpIT9ZHrolOOXF4vCazuz1Jwc0asv9SLGCKYFDL+4YXZ thoFiH8NR7EHdDqUdUTv3uW71rR7LU6t+bK9OTPM1iqtYRcdcFGepjc0lLxRra9uzYkq MXLAt6i236XOipewYzkjp0rMsHQEzR12YhcAUstNnIpaiIAVsP0PS7kvOVKuRG4vDYwj bfIT/oYITtegdMzqVXqY32T0AJ10NW+HTaQgxaeUM31FYj8Kx1CfTEJF+5K307VfRR7o aCvr8OxjhWtn8xJ5eR7sD4DWSM6KFlOmDdQNEQV9gPnSJW+S2BuXCpg14/X+UxKb9Xbr AsnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=8ilKX+a70jTPPEN//PJ60e7XsFBDrxK1bHnpEzpl1JY=; b=YQpJ+fabWpliOzLpCrcTUuE3g3/Z9VNueN0KW0Xk/oNOKbwmzfZbIX0B92eHAuFLkC nAwjecX1AmIt+c8boT3AKl0v45m8dXOh1WIUJd0IZABhZui7upHqiCYS6hc4O6Rd5LZQ LfPzwAvfVv3X3n0dw1lBy7LN+uqkeaRykhwWYSqvFl6MSKZKHO6g3H0VjKmU5lgyH1mY dMcEu064dJ4PlOmurmn1+Crk659shNbo8oqlqge8dR4HBrLDrfqW6TVqGVoLOYYxyf58 Ev5JvmWauMwHTTFXn7+nHQ1X4AYmC/kUPUeOrJ61Swq+SY6wqU3FUtRQQcf7WSv9KA3l webg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z2jV8B13; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x4si14917538eju.496.2020.08.19.05.24.58; Wed, 19 Aug 2020 05:25:21 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z2jV8B13; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728015AbgHSMWA (ORCPT + 99 others); Wed, 19 Aug 2020 08:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbgHSMV4 (ORCPT ); Wed, 19 Aug 2020 08:21:56 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C1B2C061757; Wed, 19 Aug 2020 05:21:56 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id s16so17544472qtn.7; Wed, 19 Aug 2020 05:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=8ilKX+a70jTPPEN//PJ60e7XsFBDrxK1bHnpEzpl1JY=; b=Z2jV8B13DC70Ru2gQFkwcdUpG/4jYcVF3Zt8PiAh/6QCrw3nWLp1arQPSh64AagVww gHMQZ3AUCIJ1Aj/J/XiGEpL956v6X8KJtx3cb2Zf1Q0oS69hv2Usld1HHt+zFk4sqvLo YAuKRaSFvi4plK9CQ1ULQbVhELyotnZ0x8E3+w4Q3ad6A4jx9erikr1O5ZNjsRU5dUsp UUft0A7LtcoX70srXjhjAmgYYXUXBzuA/04OGokFWoBqFZZ4ZVUV0LlPV5f8wmKpioWi U7z9oixRIYE7EKW/cG/QqYcgd990b+Kkhw28R5G+sh10ZjxxlFMbdPljT35aKUKQhjbl 9/qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=8ilKX+a70jTPPEN//PJ60e7XsFBDrxK1bHnpEzpl1JY=; b=oRpManZuxzTm7F9xN4tRYTSqpoV/A5OcYPuLhcYWTa52HxypBnkEkpd5ZUTVB90+ZV WW7lLPKRfmenLdhUeAAVYxg5yPK0YR+ddkkMcjns7zYYBOwmNm55lWTI/nARBxH3M2hG d7Vkt1+VcDTb4p19oXK07/b54yHtQRHAM8yO/2BidHWSgMd3bnMCHKoTp4U/4rwDuOlV p8Bqht0iqXtDOC/fcKhBsVXpmW+h040y3dWHjbWSH6LyhaYd7i0kxzqG/S2L5AHkfvAD nqG9emD/rG7YCyvLbe3Sibf9L6tDCQxZ0cpQQDMzFEfroosoY8cPVR8m+aC4SzuOUrsv C01A== X-Gm-Message-State: AOAM5319kodOqkM0mJLQtj+XVqBfAVVSIjuAnznUUwSBpaAmAEpkgCzg ExDZvGhfAC6iNMa2Mj3ZWC/yxB9b1NI= X-Received: by 2002:aed:38e6:: with SMTP id k93mr21036770qte.90.1597839715641; Wed, 19 Aug 2020 05:21:55 -0700 (PDT) Received: from [192.168.1.190] (pool-68-134-6-11.bltmmd.fios.verizon.net. [68.134.6.11]) by smtp.gmail.com with ESMTPSA id v28sm29331368qtk.28.2020.08.19.05.21.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Aug 2020 05:21:55 -0700 (PDT) Subject: Re: [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab To: Colin King , Paul Moore , Eric Paris , Ondrej Mosnacek , selinux@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200819104256.51499-1-colin.king@canonical.com> From: Stephen Smalley Message-ID: <20dcb065-7f19-423a-81c2-cb9524a730de@gmail.com> Date: Wed, 19 Aug 2020 08:21:54 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200819104256.51499-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/19/20 6:42 AM, Colin King wrote: > 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 Acked-by: Stephen Smalley > --- > 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);