Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1995277pxb; Mon, 18 Jan 2021 05:42:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0PYSQQOCJ1Q5F9qZau3mqckOLLJ2L1Gj/YxiCNJJV8cm7wwz5afSoMQYMHItN+DeeQrWj X-Received: by 2002:a05:6402:ca1:: with SMTP id cn1mr19171601edb.128.1610977326024; Mon, 18 Jan 2021 05:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610977326; cv=none; d=google.com; s=arc-20160816; b=P/2z+sk92Y0MQKxa5bgWeXBopfsHtLv2apY1radT74kl7skXDLhLc1ZE7yV3GQW0E5 knGxgeiRvSO7osalfX4BggelShRdOhspgl678XBCXC6Lr5I4nXOl07kR7/tgYzxkaSMX /EB2MyLjZLXTmS37UjJdu1c0Uu+aR6tWsFfua2XaWzaaxKmHPhRE/OeEJWj3aoV7G3Pm CnS0lRF+unQ/tiUYrF4LUfYlBwZOs8Jir12xaKXKsXLQmv2UqmtsnZcP2HDI8qCFJfz0 wHcWKJPd7oRIGmVJyMMvtscn7AzS+d/nWuFxrYk2gKA4JTlMUwmcGCmThnOKBMKOb3ek I/iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hv7PXqG0fFj0pb5FKWZNyKiMO2O3gluLHafNTQwvit4=; b=OxmjmhxbRE3kcJOTus3bXkMstOgEL7cKA/ygsZJypAvp4NCeMjXa1Rl22tq4tzEcU6 iTcIJsNUP51EdXbEjtzpNeoDbS36qBVJt+T7ceKSHN9PoAkfYPMIRgtZ+ryK8KkylgKe dZZBouEPD+VEXeFLBUxJY/mUV0tG2hxF9QVoYL82WBz/SR75keUTW0yD1UWBePttSTGW jiAjeLTFeZhHURQgxyefqIgUd/xa6MY+03p0TbGlPQRjpfaL2wnf3OlKxwNUKhgAWkjU rFpymxaYk0L661J9TaO09ZXFlCPqihppiMJ5L1s5YZcvQxdtDoy7oeTU0G3qucTW2kkW mIVA== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si6632628edo.565.2021.01.18.05.41.41; Mon, 18 Jan 2021 05:42:06 -0800 (PST) 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392237AbhARNix (ORCPT + 99 others); Mon, 18 Jan 2021 08:38:53 -0500 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:49185 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392314AbhARNfU (ORCPT ); Mon, 18 Jan 2021 08:35:20 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0UM8549h_1610976838; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0UM8549h_1610976838) by smtp.aliyun-inc.com(127.0.0.1); Mon, 18 Jan 2021 21:33:58 +0800 From: Tianjia Zhang To: Jarkko Sakkinen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , Shuah Khan , haitao.huang@intel.com, Kai Huang , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Jia Zhang Cc: Tianjia Zhang Subject: [PATCH] x86/sgx: Remove redundant if conditions in sgx_encl_create Date: Mon, 18 Jan 2021 21:33:58 +0800 Message-Id: <20210118133358.99311-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.3.ge56e4f7 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In this scenario, there is no case where va_page is NULL, and the error has been checked. The if condition statement here is redundant, so remove the condition detection. Reported-by: Jia Zhang Signed-off-by: Tianjia Zhang --- arch/x86/kernel/cpu/sgx/ioctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c index 90a5caf76939..f45957c05f69 100644 --- a/arch/x86/kernel/cpu/sgx/ioctl.c +++ b/arch/x86/kernel/cpu/sgx/ioctl.c @@ -66,9 +66,8 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs) va_page = sgx_encl_grow(encl); if (IS_ERR(va_page)) return PTR_ERR(va_page); - else if (va_page) - list_add(&va_page->list, &encl->va_pages); - /* else the tail page of the VA page list had free slots. */ + + list_add(&va_page->list, &encl->va_pages); /* The extra page goes to SECS. */ encl_size = secs->size + PAGE_SIZE; -- 2.19.1.3.ge56e4f7