From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: efi_loader: pkcs7_parse_message() returns error pointer
Date: Fri, 8 May 2020 08:53:22 +0900 [thread overview]
Message-ID: <20200507235322.GC30323@laputa> (raw)
In-Reply-To: <17238d2d-6f48-d23b-9cab-2c30e8da0110@gmx.de>
Heinrich,
On Thu, May 07, 2020 at 04:47:22PM +0200, Heinrich Schuchardt wrote:
> On 07.05.20 02:17, Patrick Wildt wrote:
> > Since pkcs7_parse_message() returns an error pointer, we must not
> > check for NULL. We have to explicitly set msg to NULL in the error
> > case, otherwise the call to pkcs7_free_message() on the goto err
> > path will assume it's a valid object.
>
> @Takahiro
> I think we should start documenting the library functions properly. The
Generally I agree, but
> description in lib/crypto/pkcs7_parser.c does not conform to
> https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#function-documentation
> Especially we should describe how errors are returned.
Remember that this file, as well as others under lib/crypto, was
imported from linux kernel source.
I made a minimum set of changes to align it with U-Boot code.
So I'm rather reluctant to modify the file.
Thanks,
-Takahiro Akashi
> Best regards
>
> Heinrich
>
> >
> > Signed-off-by: Patrick Wildt <patrick@blueri.se>
> >
> > diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c
> > index 5a9a6424cc..43a53d3dd1 100644
> > --- a/lib/efi_loader/efi_image_loader.c
> > +++ b/lib/efi_loader/efi_image_loader.c
> > @@ -538,8 +538,9 @@ static bool efi_image_authenticate(void *efi, size_t efi_size)
> > }
> > msg = pkcs7_parse_message((void *)wincert + sizeof(*wincert),
> > wincert->dwLength - sizeof(*wincert));
> > - if (!msg) {
> > + if (IS_ERR(msg)) {
> > debug("Parsing image's signature failed\n");
> > + msg = NULL;
> > goto err;
> > }
> >
> >
>
next prev parent reply other threads:[~2020-05-07 23:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 0:17 efi_loader: pkcs7_parse_message() returns error pointer Patrick Wildt
2020-05-07 14:47 ` Heinrich Schuchardt
2020-05-07 23:53 ` AKASHI Takahiro [this message]
2020-05-07 16:02 ` Heinrich Schuchardt
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=20200507235322.GC30323@laputa \
--to=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.de \
/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