Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp363369rwr; Wed, 19 Apr 2023 07:31:05 -0700 (PDT) X-Google-Smtp-Source: AKy350aiS6mgcNKwVQrQu3aiuoSvmucsdzyqMWfmQZL2jtxtOBrxXZ72Zh3CW4QOzM+3ZJALDunT X-Received: by 2002:a17:90a:c503:b0:240:7f0d:9232 with SMTP id k3-20020a17090ac50300b002407f0d9232mr3026812pjt.3.1681914665258; Wed, 19 Apr 2023 07:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681914665; cv=none; d=google.com; s=arc-20160816; b=blJ22QCSfoFCQDgfvMKGYqONdk2Zy25+7EsfT7JcNG4eSd2rtcli7+aT/8uz6FcpHD 6Ex82Rz4XgWY/9xw82X2ewPnnhW017JD8JgcbCgly110PHWN8SliP/CiPp3yaAYZyIpO JjtKTQ4j3XDDYcr09xnAWgxvWUWY5IH2c6KRC8c0oAvhbkFuCLAersQAyIK0eg52ua6R xaZTwHgEhQKNqMjA9z/b9c+pOJMeErmH6CfsdIV0Mfi3KkArtahOdhOW36psnCNwJ783 79eU9IWXjrn9d4QdxbC+ZpKKKmR9YxRnShSuwoNsPvsEnrnxZ/UAe0ntrq6RYFxuM/52 0bRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6fddd8ox6aQC7uIazNKAO86RmJ0l1uLpsL7Vx31zPUU=; b=TyOYH77VsUK1QLAfe8gabHrwBV10diyE0zyJAHF4w8pvacpTbW7CnhgogL/f8AxlLg D2f1BPJlBd9qG8aKu8loNBYVn2Y3+fVP3agaFuRysgvYdZ9/y7GUBHcAVk/H7cxW66CG lG/4qesO9cwdTy4OURZtD8Ux74NQqdFqH2mamUUDBcVyA7vJmq5r5cilCmsT6DfnHY9D rZnTI5sr3hWSG65Jr2lKy+TGIJg2jgOiHERD3awe2cMpzjuKNawDFpBe46P1kySBfo/i ohJrBesZdKfPqQg8wrelm7mu8AWknWRC9wW8t1WubnCdG61uA9seywa65uaw9usFotaK TRMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=haROrECK; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me6-20020a17090b17c600b00247303bfcd6si2003538pjb.168.2023.04.19.07.30.41; Wed, 19 Apr 2023 07:31:05 -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=@kernel.org header.s=k20201202 header.b=haROrECK; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233042AbjDSOaI (ORCPT + 99 others); Wed, 19 Apr 2023 10:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233233AbjDSO36 (ORCPT ); Wed, 19 Apr 2023 10:29:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327F310B; Wed, 19 Apr 2023 07:29:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0E61611EA; Wed, 19 Apr 2023 14:29:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DB3AC4339E; Wed, 19 Apr 2023 14:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681914596; bh=5N3EpBQ8+tdcc/u8S5fLufyhARxNyKuBZ4a63Z9mYzk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=haROrECKbMWvDzSoqZj35HjHmtvaR1P0XjUQG/sjtMT6x8rQAmFN1HDqOVBUU851o G9AaZF3b/doCKg2d09p+PDTtW8G+TP4JEh30wLzAjEibMakZ0rQoQW74xQP/ZaBxwB U/Fr3+MnfK5Ece24Cf42i9W1aZfh9oL6wGpqMpwI2f6CdTTaUIAxebuhdh32UDv10K dCyoga2HBswd8TxjDMHCkiJozVwd/FQhIWLSFA2wXrJfRRAuMpfdTW6xqD8fKRs/Vx aJHyB01A2E9+YmQ2/8HWotPB8Cu51iguIWyktnGhOBCe/q1/K8MO9nvQhvH4egQ6/p 8ajZKp2eqhXzA== Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-4ec816d64afso13649924e87.1; Wed, 19 Apr 2023 07:29:55 -0700 (PDT) X-Gm-Message-State: AAQBX9dTErxG+P3la3IbvLSoxS9X8t6V2IeLyU7s1xNsIOlwncS9Ys2d xjnveORfzpSHaUUkrI7PpzY0HFMoCVbl9zs2JNI= X-Received: by 2002:a05:6512:2823:b0:4eb:412f:9e0e with SMTP id cf35-20020a056512282300b004eb412f9e0emr851882lfb.26.1681914594087; Wed, 19 Apr 2023 07:29:54 -0700 (PDT) MIME-Version: 1.0 References: <73859c9e-dea0-4764-bf01-7ae694fa2e37@kili.mountain> In-Reply-To: <73859c9e-dea0-4764-bf01-7ae694fa2e37@kili.mountain> From: Ard Biesheuvel Date: Wed, 19 Apr 2023 16:29:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] arm64: delete dead code in this_cpu_set_vectors() To: Dan Carpenter Cc: James Morse , Will Deacon , Kristina Martsenko , Mark Rutland , Mark Brown , Liu Song , D Scott Phillips , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, 19 Apr 2023 at 09:58, Dan Carpenter wrote: > > 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); > > /* > -- > 2.39.2 >