From nobody Thu Sep 18 01:19:03 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 788AEC10F1D for ; Tue, 13 Dec 2022 14:13:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235952AbiLMONJ (ORCPT ); Tue, 13 Dec 2022 09:13:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235924AbiLMOMb (ORCPT ); Tue, 13 Dec 2022 09:12:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282741CFDD; Tue, 13 Dec 2022 06:11:28 -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 ams.source.kernel.org (Postfix) with ESMTPS id AB197B81189; Tue, 13 Dec 2022 14:11:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E5C0C433D2; Tue, 13 Dec 2022 14:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670940686; bh=i4+X36aP4iUnP5dBT/vzjdrM0ePyEqx+ak2BmIRIs+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PUxzoLVpYu2qisXG8MRJM5a56Uhdf/Ac/MoPyQmvI/hmHJ396CvYKXxq0iI31bsu2 SaILArKAyI1DM2hqnBH6YCjZXr+cFzR1f/baQbcdt109Esjg3dQVDqAYrwMuIEgYYh iQpMkz2pDY3vmKSDVqWOxFXR6acAtblYHHS8hPV16FgL5ccWG35AoMzE+SG+RysjIa r/53WQCnFsMXLnJ2/q3uDdJ6S2To+/aNMBz86cUV1aXQRLd4XNea6TPUuTl9ueUlPS XWilQ42gRdNf5ZphpXp57CRHOPQ89MR3NaMiHCD4qid+f0foYHeRp5rfQw4MIc/1ja SdEa8IQT1prSw== 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, Akinobu Mita , Randy Dunlap Subject: [PATCH v2 1/2] error-injection: Remove EI_ETYPE_NONE Date: Tue, 13 Dec 2022 23:11:21 +0900 Message-Id: <167094068123.608798.9238149148720683524.stgit@devnote3> X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog In-Reply-To: <167094067084.608798.11303550366840600235.stgit@devnote3> References: <167094067084.608798.11303550366840600235.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") --- Changes in v2: - include linux/errno.h --- include/asm-generic/error-injection.h | 1 - include/linux/error-injection.h | 3 ++- lib/error-inject.c | 2 +- 3 files changed, 3 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..20e738f4eae8 100644 --- a/include/linux/error-injection.h +++ b/include/linux/error-injection.h @@ -3,6 +3,7 @@ #define _LINUX_ERROR_INJECTION_H =20 #include +#include #include =20 #ifdef CONFIG_FUNCTION_ERROR_INJECTION @@ -19,7 +20,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) {