Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Pratyush Anand <panand@redhat.com>
Cc: kexec@lists.infradead.org, kexec@lists.fedoraproject.org
Subject: Re: [PATCH RFC 2/6] purgatory: No need to sha256 update if ptr->len is zero
Date: Mon, 20 Apr 2015 11:01:08 +0800	[thread overview]
Message-ID: <20150420030108.GE15033@dhcp-16-116.nay.redhat.com> (raw)
In-Reply-To: <a66d1e193a9bd27e940edfbb56ca521556e95b39.1429201849.git.panand@redhat.com>

On 04/16/15 at 10:17pm, Pratyush Anand wrote:
> If ptr->len is zero we do not need to update sha256.
> 
> Signed-off-by: Pratyush Anand <panand@redhat.com>
> ---
>  purgatory/purgatory.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/purgatory/purgatory.c b/purgatory/purgatory.c
> index 3bbcc0935ad5..f8ed69b8fbfb 100644
> --- a/purgatory/purgatory.c
> +++ b/purgatory/purgatory.c
> @@ -18,6 +18,8 @@ int verify_sha256_digest(void)
>  	sha256_starts(&ctx);
>  	end = &sha256_regions[sizeof(sha256_regions)/sizeof(sha256_regions[0])];
>  	for(ptr = sha256_regions; ptr < end; ptr++) {
> +		if (ptr->len == 0)
> +			continue;

Hi Pratyush,

I don't think this is necessary, but don't object to it strongly.
Since sha256_update will check the length and return immediately if it's
0.

void sha256_update( sha256_context *ctx, const uint8_t *input, size_t
length )
{                             
        size_t left, fill;
 
        if( ! length ) return;

...
}

Thanks
Baoquan

>  		sha256_update(&ctx, (uint8_t *)((uintptr_t)ptr->start),
>  			      ptr->len);
>  	}
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2015-04-20  3:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 16:47 [PATCH RFC 0/6] Various fixes for purgatory and ARM64 Pratyush Anand
2015-04-16 16:47 ` [PATCH RFC 1/6] purgatory: Fix memcmp for src address increment Pratyush Anand
2015-04-17 16:55   ` Geoff Levand
2015-04-20  0:25     ` Simon Horman
2015-04-22 11:19       ` Pratyush Anand
2015-04-23  2:23         ` Simon Horman
2015-04-16 16:47 ` [PATCH RFC 2/6] purgatory: No need to sha256 update if ptr->len is zero Pratyush Anand
2015-04-17 16:58   ` Geoff Levand
2015-04-17 23:26     ` Pratyush Anand
2015-04-20  3:01   ` Baoquan He [this message]
2015-04-20  3:18     ` Pratyush Anand
2015-04-16 16:47 ` [PATCH RFC 3/6] arm64: allocate memory for other segments after kernel Pratyush Anand
2015-04-17 16:59   ` Geoff Levand
2015-04-20  3:21   ` Baoquan He
2015-04-21  4:19     ` Pratyush Anand
2015-04-21 10:06       ` AKASHI Takahiro
2015-04-22  6:16         ` AKASHI Takahiro
2015-04-16 16:47 ` [PATCH RFC 4/6] arm64: support reuse-cmdline option Pratyush Anand
2015-04-17 17:02   ` Geoff Levand
2015-04-16 16:47 ` [PATCH RFC 5/6] arm64: Add support for binary image Pratyush Anand
2015-04-17 17:07   ` Geoff Levand
2015-04-17 18:00     ` Geoff Levand
2015-04-17 23:27       ` Pratyush Anand
2015-04-20  7:24   ` Baoquan He
2015-04-21  4:42     ` Pratyush Anand
2015-04-22  2:53       ` Baoquan He
2015-04-22 11:19         ` Pratyush Anand
2015-04-16 16:47 ` [PATCH RFC 6/6] arm64: wait for transmit completion before next character transmission Pratyush Anand
2015-04-17  5:36   ` Minfei Huang
2015-04-17  5:37     ` Pratyush Anand
2015-04-20  2:58       ` Baoquan He
2015-04-20  3:34         ` Pratyush Anand
2015-04-17 17:22   ` Geoff Levand
2015-04-17 23:31     ` Pratyush Anand
2015-04-16 23:54 ` [PATCH RFC 0/6] Various fixes for purgatory and ARM64 Simon Horman
2015-04-17  1:27 ` Dave Young
2015-04-17  2:48   ` Pratyush Anand
2015-04-17 17:27 ` Geoff Levand

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=20150420030108.GE15033@dhcp-16-116.nay.redhat.com \
    --to=bhe@redhat.com \
    --cc=kexec@lists.fedoraproject.org \
    --cc=kexec@lists.infradead.org \
    --cc=panand@redhat.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