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: 13216493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD671C77B78 for ; Wed, 19 Apr 2023 07:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=aDPGWQTA0q63p1x5MFyeP5BQRDFR2W5u5F+ka/CBG28=; b=tHWR4dwr5u7AM/ 8HB5+OrGGHthOZdizkB5ne7Yr1EX1K3s3PIV1RjkSL3ETSk6EGu3bRBF2vrlTbhVi49rJI4qSMmlk OIK/8eAjPhh9Oa9EX041p/GDi8k0AlFsBJXRLV6vdw2pECDSU+9OtJ+Rsuj4y02/46uP5HaeMnlI/ EkPSv2TqgO1opuCfiOsGz9DCuSTiqiKetdfQkKkVSMguB2rZvRB93gP2f7xIULXA5SebgBizuUZxU V1BE1aWcmGszfJ+jkNrpOTROFuxI8cuRdVSQpTgSRqDTHf9cbv1Wrkm6JhgQiShOfVD9Zgob/qXX2 nFH2mdGIOtjyC6/ThEcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pp2iM-004W3b-2b; Wed, 19 Apr 2023 07:58:54 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pp2iJ-004W2s-1e for linux-arm-kernel@lists.infradead.org; Wed, 19 Apr 2023 07:58:52 +0000 Received: by mail-wm1-x329.google.com with SMTP id o9-20020a05600c510900b003f17012276fso966863wms.4 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=AOTPd8X117myCLEKvjaf/frGs7nltWIH7XEhJYX1gKD5JMkUM5CMC3gX28/8PY2n77 5lmFziJ6bDJ0hbCY84TlgtvTlxfMIJPhUdPn6qO+VZtAVLrJ/DhPUzD/F17s+uHs9QVX bMyK669V8sJK7MK4NpVbpJhQbBOYSmtUxebdM3ZYlstkQ5VpXtdjscgs+gZdUTcYAXwd R2sTV7wZQkJSUBRzL9WHY4Frx5lWPP20gJS+POcuIMfB1L3ZVYQwk+pv984uEVOOwar5 /qw1GmhVezoT/OUwOo65wSab3TAx8bzRfx2qBFVKClZMPzCRyCHLInr0Kc2MdjZKQrmQ 8BUA== X-Gm-Message-State: AAQBX9eSEsq05qM1A6ErmJwBL0a8LrgkPSRA0gBNlI1xAwF5JoCR4s4N BSE3HPhr5ZVJ1wBBY4AQZ0hYdw== X-Google-Smtp-Source: AKy350YWB4M+Tend0JFwwajhPdp0/tpo8ptDFpbt4km0eviie9q/Xfu+JpYBnj4Dy9cuZ/Ktki9wBA== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230419_005851_550025_B4D3D25B X-CRM114-Status: GOOD ( 11.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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); /*