From nobody Thu Sep 18 04:32:40 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05A84C4332F for ; Mon, 12 Dec 2022 02:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbiLLCrE (ORCPT ); Sun, 11 Dec 2022 21:47:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231176AbiLLCqy (ORCPT ); Sun, 11 Dec 2022 21:46:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54F6CDEFC; Sun, 11 Dec 2022 18:46:49 -0800 (PST) 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 87D9260ECB; Mon, 12 Dec 2022 02:46:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38587C433F1; Mon, 12 Dec 2022 02:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670813209; bh=p9sKnd8jvAp0+7aHcpBSpZt7PeyVZOq2wnu/bgXhOAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqZzqCO4IO/LXXuJBlq967d9RhgLMTOvSEALksDzf0H52/LxJt4PS6rv+5kWH7DJA FWJ71pKwdnueowZoYw1/0pTPoeWi/AA78nrNqBPoTq4uSzjWWpY6CwARbNbeHrT1Id PELHVCjhkLm/6TxLICjLubRMsAfOP0KLLRE4/ZyeBUNFgvz+9MDhva7JIyAGYS6xxY 6kk6Sgk7asE565Zbo/Q6dMCOxkgHS0yEFq9Jo5afVf3mHAeShf72iasWG7da/0IB0X a2ZY6QOxPaISJ1ybQF6vfDEOTX+mPfrSFifX3XqpLw8TQt2GLZOPtZmTLeFA+QQIBu yPV2ruy5aeW2A== From: "Masami Hiramatsu (Google)" To: LKML Cc: bpf@vger.kernel.org, Borislav Petkov , Alexei Starovoitov , Steven Rostedt , Linus Torvalds , Masami Hiramatsu , Andrew Morton , Peter Zijlstra , Kees Cook , Josh Poimboeuf , KP Singh , Mark Rutland , Florent Revest , Greg Kroah-Hartman , Christoph Hellwig , Chris Mason , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH 1/2] error-injection: Remove EI_ETYPE_NONE Date: Mon, 12 Dec 2022 11:46:44 +0900 Message-Id: <167081320421.387937.4259807348852421112.stgit@devnote3> X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog In-Reply-To: <167081319306.387937.10079195394503045678.stgit@devnote3> References: <167081319306.387937.10079195394503045678.stgit@devnote3> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu (Google) Since the EI_ETYPE_NONE is confusing type, replace it with appropriate errno. The EI_ETYPE_NONE has been introduced for a dummy (error) value, but it can mislead people that they can use ALLOW_ERROR_INJECTION(func, NONE). So remove it from the EI_ETYPE and use appropriate errno instead. Signed-off-by: Masami Hiramatsu (Google) Fixes: 663faf9f7bee ("error-injection: Add injectable error types") --- include/asm-generic/error-injection.h | 1 - include/linux/error-injection.h | 2 +- lib/error-inject.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/asm-generic/error-injection.h b/include/asm-generic/er= ror-injection.h index fbca56bd9cbc..c0b9d3217ed9 100644 --- a/include/asm-generic/error-injection.h +++ b/include/asm-generic/error-injection.h @@ -4,7 +4,6 @@ =20 #if defined(__KERNEL__) && !defined(__ASSEMBLY__) enum { - EI_ETYPE_NONE, /* Dummy value for undefined case */ EI_ETYPE_NULL, /* Return NULL if failure */ EI_ETYPE_ERRNO, /* Return -ERRNO if failure */ EI_ETYPE_ERRNO_NULL, /* Return -ERRNO or NULL if failure */ diff --git a/include/linux/error-injection.h b/include/linux/error-injectio= n.h index 635a95caf29f..268fecfc1e82 100644 --- a/include/linux/error-injection.h +++ b/include/linux/error-injection.h @@ -19,7 +19,7 @@ static inline bool within_error_injection_list(unsigned l= ong addr) =20 static inline int get_injectable_error_type(unsigned long addr) { - return EI_ETYPE_NONE; + return -EOPNOTSUPP; } =20 #endif diff --git a/lib/error-inject.c b/lib/error-inject.c index 1afca1b1cdea..32c14770508e 100644 --- a/lib/error-inject.c +++ b/lib/error-inject.c @@ -40,7 +40,7 @@ bool within_error_injection_list(unsigned long addr) int get_injectable_error_type(unsigned long addr) { struct ei_entry *ent; - int ei_type =3D EI_ETYPE_NONE; + int ei_type =3D -EINVAL; =20 mutex_lock(&ei_mutex); list_for_each_entry(ent, &error_injection_list, list) {