From patchwork Wed Apr 19 07:58:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 85246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp201917vqo; Wed, 19 Apr 2023 01:06:28 -0700 (PDT) X-Google-Smtp-Source: AKy350ZVtEuaYFA2i8SYncxFCM46gacgImhXIAFYCRD1zxSZd0Z/Elta8Czkuwt2PpEOTMmFtHrJ X-Received: by 2002:a67:dc86:0:b0:42e:3c39:730f with SMTP id g6-20020a67dc86000000b0042e3c39730fmr590699vsk.2.1681891588057; Wed, 19 Apr 2023 01:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681891588; cv=none; d=google.com; s=arc-20160816; b=SuyVCLQXJ9C6Iz6BdUMQp+ieEkgkosMRS3puFfXJCl2mE5kWrukFC8j/tmVxsCRvTg 6qGCMSLZ+4Vs7rYurA81hPQjlAJoBUcs/TWHvu2MdoxKv54Tsco5uEQpxNjeTeptCq6u Enk7KA5lf07LLlO9dwXGhrqmUUiUF7SQYeQwQ2pIopsSwjD7DtvlN5TQ1FdVn420NnqM t/1sORH4EJpO5kSkP7MxjI3k9Rx1r47QZDIj8I8mEe0jY/s6BF2OSQ1U2Bix11fKy39M KRK4HzHfdxPc0BNeLFb+vjfSlAO2ng+y7r7DWrQlWPaIEXrwk9C7shu0MA1H0AJ1eMY7 5IyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=v9nhWTNFUot8DhVxJTGVf8U7r1UFd9xR4G2cjz6ra5U=; b=RzTH2DRfYNMEuO69NBwd0CKNGaHUgPOWit8ty0OPAwt8on/TfwvV2wzAPZf99SoPta j8TdrffgcXZR3uAYIXn7QMrMG7ZE7ENtKY8ShJVN4FIfGHqfUi8yigLJ5iSr/hUmDd7U 8TWy3eQJLVgnxPf/2SaMtAkk+EtUaMU+FngaSASDTlmFUsrl4Sm+R27GN7UfOEZ0j9Z8 qXJZSOguycVqXYXq4PPil5rlk6C8c4qDIVwEfp2qe43hqO9OLn0+BSdjokEm/b0EvJGu bJEabVK8ThPLPCWtqEzewJMY9VWPboV8tx2q5paPREPCGf/YSZfbcfkX1clNG7b1omod DUqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EGBfyPyJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020a67c292000000b00425eb54651esi3466646vsj.204.2023.04.19.01.06.14; Wed, 19 Apr 2023 01:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EGBfyPyJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbjDSH6y (ORCPT + 99 others); Wed, 19 Apr 2023 03:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231128AbjDSH6w (ORCPT ); Wed, 19 Apr 2023 03:58:52 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC8D49D2 for ; Wed, 19 Apr 2023 00:58:51 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id d8-20020a05600c3ac800b003ee6e324b19so969479wms.1 for ; Wed, 19 Apr 2023 00:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681891130; x=1684483130; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=v9nhWTNFUot8DhVxJTGVf8U7r1UFd9xR4G2cjz6ra5U=; b=EGBfyPyJHJotUnoVy1IkY/z6izta25ZfsN2JEoy7WTUfA2I/BsJnN1O/cGBb9O6axs Q+SZT3mKAnoCtliZ+TRB+QWM9K5ES5jHA2a6j9xIpoo+tWdQvuF4XBrDs3085yMn2ajB XI5+iIOwoaCrXk1FmUiH+A4Sf9SnQvAjRjfzbKH2gFO5cCvpjvfRKxsXtSRaCJfGjG0I AaYKERq25347rd+waTxa58Ifxf5rRW5e+g8Q48fpTjblXj1heahw1x+1JG4b80FE2k33 Q70fMZmKlNPuox0UJjNcIVPNS2gW0xmt+EN73JafKqhsrE8EFhtyP/MXLWBtBhEBXQEM vK9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681891130; x=1684483130; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=v9nhWTNFUot8DhVxJTGVf8U7r1UFd9xR4G2cjz6ra5U=; b=EI1orF2CrrXvuhGrJBOvipvm1iQWNEiFIScdhQVhtpaBj1oZ0TAoxSQr2p3JiPOiOu Nwxv1k6cMe1tIuPpSJssoGRHioCEOWN7SjxHKJ2BlZZO7hzL/mP0HNyjjT0sSSBYoPyJ YTIUTWeiukjeDWNlgyyp+PVaKwnAXvp2t+bYHmBnfrzjSCkKXKxUQNG3zTjFwOvVZNpw v3VJ9OnWDD+GLe4HQmKrZxh73QIcFmCQvVVq/b472DDGPOH/MpQMwARs5ePphdADnOBg p+sHkFOHk7GIClUwgsN2F2KL+JZlSC3q5QiXezPpkUvxmwc7YRcrUm/5KUfNx+BmF621 JzkA== X-Gm-Message-State: AAQBX9e84i8iTgr31iXp53+S7+Zz+ErSiBmtWbaCX/kAxdtEMZ/SfMge RXb52ivbEEDT4ZswUGIcDfo7Cg== X-Received: by 2002:a7b:cbd0:0:b0:3f1:75b3:60df with SMTP id n16-20020a7bcbd0000000b003f175b360dfmr5955964wmi.41.1681891129997; Wed, 19 Apr 2023 00:58:49 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id p19-20020a05600c205300b003f173a00304sm1330043wmg.17.2023.04.19.00.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 00:58:49 -0700 (PDT) Date: Wed, 19 Apr 2023 10:58:43 +0300 From: Dan Carpenter To: James Morse Cc: Will Deacon , Kristina Martsenko , Mark Rutland , Mark Brown , Ard Biesheuvel , Liu Song , D Scott Phillips , James Morse , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] arm64: delete dead code in this_cpu_set_vectors() Message-ID: <73859c9e-dea0-4764-bf01-7ae694fa2e37@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763591153665302147?= X-GMAIL-MSGID: =?utf-8?q?1763591153665302147?= The "slot" variable is an enum, and in this context it is an unsigned int. So the type means it can never be negative and also we never pass invalid data to this function. If something did pass invalid data then this check would be insufficient protection. Signed-off-by: Dan Carpenter Acked-by: Ard Biesheuvel --- arch/arm64/kernel/proton-pack.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index fca9cc6f5581..05f40c4e18fd 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -966,9 +966,6 @@ static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot) { const char *v = arm64_get_bp_hardening_vector(slot); - if (slot < 0) - return; - __this_cpu_write(this_cpu_vector, v); /*