[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200925021045.d45f862caf4011767bbafba3@kernel.org>
Date: Fri, 25 Sep 2020 02:10:45 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Barnabás Pőcze <pobrn@...tonmail.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Akinobu Mita <akinobu.mita@...il.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] fault-injection: handle EI_ETYPE_TRUE
On Thu, 24 Sep 2020 16:48:56 +0000
Barnabás Pőcze <pobrn@...tonmail.com> wrote:
> Commit af3b854492f351d1ff3b4744a83bf5ff7eed4920
> ("mm/page_alloc.c: allow error injection")
> introduced EI_ETYPE_TRUE, but did not extend
> * lib/error-inject.c:error_type_string(), and
> * kernel/fail_function.c:adjust_error_retval()
> to accommodate for this change.
>
> Handle EI_ETYPE_TRUE in both functions appropriately by
> * returning "TRUE" in error_type_string(),
> * adjusting the return value to true (1) in adjust_error_retval().
>
> Furthermore, simplify the logic of handling EI_ETYPE_NULL
> in adjust_error_retval().
This looks good to me.
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Thank you!
>
> Signed-off-by: Barnabás Pőcze <pobrn@...tonmail.com>
> ---
> kernel/fail_function.c | 6 +++---
> lib/error-inject.c | 2 ++
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/fail_function.c b/kernel/fail_function.c
> index 63b349168da7..4fdea01c0561 100644
> --- a/kernel/fail_function.c
> +++ b/kernel/fail_function.c
> @@ -37,9 +37,7 @@ static unsigned long adjust_error_retval(unsigned long addr, unsigned long retv)
> {
> switch (get_injectable_error_type(addr)) {
> case EI_ETYPE_NULL:
> - if (retv != 0)
> - return 0;
> - break;
> + return 0;
> case EI_ETYPE_ERRNO:
> if (retv < (unsigned long)-MAX_ERRNO)
> return (unsigned long)-EINVAL;
> @@ -48,6 +46,8 @@ static unsigned long adjust_error_retval(unsigned long addr, unsigned long retv)
> if (retv != 0 && retv < (unsigned long)-MAX_ERRNO)
> return (unsigned long)-EINVAL;
> break;
> + case EI_ETYPE_TRUE:
> + return 1;
> }
>
> return retv;
> diff --git a/lib/error-inject.c b/lib/error-inject.c
> index aa63751c916f..c73651b15b76 100644
> --- a/lib/error-inject.c
> +++ b/lib/error-inject.c
> @@ -180,6 +180,8 @@ static const char *error_type_string(int etype)
> return "ERRNO";
> case EI_ETYPE_ERRNO_NULL:
> return "ERRNO_NULL";
> + case EI_ETYPE_TRUE:
> + return "TRUE";
> default:
> return "(unknown)";
> }
> --
> 2.28.0
>
>
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists