From: Joey Lee <JLee@suse.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "Lee, Chun-Yi" <joeyli.kernel@gmail.com>,
James Morris <jmorris@namei.org>,
"Serge E . Hallyn" <serge@hallyn.com>,
David Howells <dhowells@redhat.com>,
Josh Boyer <jwboyer@fedoraproject.org>,
Nayna Jain <nayna@linux.ibm.com>,
Mimi Zohar <zohar@linux.ibm.com>,
linux-efi <linux-efi@vger.kernel.org>,
linux-security-module <linux-security-module@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2 v2] efi: add a function to convert the status code to a string
Date: Fri, 13 Dec 2019 10:33:06 +0000 [thread overview]
Message-ID: <20191213103257.GZ22409@linux-l9pv.suse> (raw)
In-Reply-To: <CAKv+Gu8sGku8e1q9ku_wXfcXTGQ5W8Lt_q5KEK9WycgHw15TgA@mail.gmail.com>
On Fri, Dec 13, 2019 at 10:03:27AM +0000, Ard Biesheuvel wrote:
> On Fri, 13 Dec 2019 at 10:07, Lee, Chun-Yi <joeyli.kernel@gmail.com> wrote:
> >
> > This function can be used to convert EFI status code to a string
> > to improve the readability of log.
> >
> > v2:
> > Moved the convert function to efi.c
> >
>
> Please put the patch series revision log below the ---
OK! I will move to below the --- next time.
>
> > Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
>
Thanks for your review!
> > ---
v2:
Moved the convert function to efi.c
> > drivers/firmware/efi/efi.c | 32 ++++++++++++++++++++++++++++++++
> > include/linux/efi.h | 1 +
> > 2 files changed, 33 insertions(+)
Do you mean move the revision log to here like the above?
Thanks a lot!
Joey Lee
> >
> > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> > index e98bbf8e56d9..8bdc1c17eb5d 100644
> > --- a/drivers/firmware/efi/efi.c
> > +++ b/drivers/firmware/efi/efi.c
> > @@ -954,6 +954,38 @@ int efi_status_to_err(efi_status_t status)
> > return err;
> > }
> >
> > +#define EFI_STATUS_STR(_status) \
> > + EFI_##_status : return "EFI_" __stringify(_status)
> > +
> > +const char *efi_status_to_str(efi_status_t status)
> > +{
> > + switch (status) {
> > + case EFI_STATUS_STR(SUCCESS);
> > + case EFI_STATUS_STR(LOAD_ERROR);
> > + case EFI_STATUS_STR(INVALID_PARAMETER);
> > + case EFI_STATUS_STR(UNSUPPORTED);
> > + case EFI_STATUS_STR(BAD_BUFFER_SIZE);
> > + case EFI_STATUS_STR(BUFFER_TOO_SMALL);
> > + case EFI_STATUS_STR(NOT_READY);
> > + case EFI_STATUS_STR(DEVICE_ERROR);
> > + case EFI_STATUS_STR(WRITE_PROTECTED);
> > + case EFI_STATUS_STR(OUT_OF_RESOURCES);
> > + case EFI_STATUS_STR(NOT_FOUND);
> > + case EFI_STATUS_STR(ABORTED);
> > + case EFI_STATUS_STR(SECURITY_VIOLATION);
> > + }
> > + /*
> > + * There are two possibilities for this message to be exposed:
> > + * - Caller feeds a unknown status code from firmware.
> > + * - A new status code be defined in efi.h but we forgot to update
> > + * this function.
> > + */
> > + pr_warn("Unknown efi status: 0x%lx\n", status);
> > +
> > + return "Unknown efi status";
> > +}
> > +EXPORT_SYMBOL(efi_status_to_str);
> > +
> > static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock);
> > static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init;
> >
> > diff --git a/include/linux/efi.h b/include/linux/efi.h
> > index d87acf62958e..2c6848d2b112 100644
> > --- a/include/linux/efi.h
> > +++ b/include/linux/efi.h
> > @@ -1228,6 +1228,7 @@ efi_capsule_pending(int *reset_type)
> > #endif
> >
> > extern int efi_status_to_err(efi_status_t status);
> > +extern const char *efi_status_to_str(efi_status_t status);
> >
> > /*
> > * Variable Attributes
> > --
> > 2.16.4
> >
next prev parent reply other threads:[~2019-12-13 10:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 9:06 [PATCH 0/2 v2] efi: cosmetic patches for the error messages when Lee, Chun-Yi
2019-12-13 9:06 ` [PATCH 1/2 v2] efi: add a function to convert the status code to a string Lee, Chun-Yi
2019-12-13 10:03 ` Ard Biesheuvel
2019-12-13 10:33 ` Joey Lee [this message]
2019-12-13 9:06 ` [PATCH 2/2] efi: show error messages only when loading certificates is failed Lee, Chun-Yi
2019-12-13 9:10 ` Ard Biesheuvel
2019-12-13 9:20 ` Joey Lee
2019-12-13 10:04 ` Ard Biesheuvel
2019-12-13 10:35 ` Joey Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191213103257.GZ22409@linux-l9pv.suse \
--to=jlee@suse.com \
--cc=ard.biesheuvel@linaro.org \
--cc=dhowells@redhat.com \
--cc=jmorris@namei.org \
--cc=joeyli.kernel@gmail.com \
--cc=jwboyer@fedoraproject.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=nayna@linux.ibm.com \
--cc=serge@hallyn.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).