mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Chris von Recklinghausen <crecklin@redhat.com>
Cc: ardb@kernel.org, simo@redhat.com, rafael@kernel.org,
	decui@microsoft.com, linux-pm@vger.kernel.org,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/1] use crc32 instead of md5 for hibernation e820 integrity check
Date: Tue, 13 Apr 2021 13:15:49 -0700	[thread overview]
Message-ID: <YHX79XWnwaAGFtxq@sol.localdomain> (raw)
In-Reply-To: <20210413161330.20024-1-crecklin@redhat.com>

On Tue, Apr 13, 2021 at 12:13:30PM -0400, Chris von Recklinghausen wrote:
> +static inline void get_e820_crc32(struct e820_table *table, void *buf)
>  {

This should just return the CRC-32 value as a u32.  There's no need for the
'void *buf' argument.

Also like I said, compute_e820_crc32() would be a more logical name.

> @@ -179,7 +133,8 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size)
>  	 */
>  	rdr->cr3 = restore_cr3 & ~CR3_PCID_MASK;
>  
> -	return hibernation_e820_save(rdr->e820_digest);
> +	hibernation_e820_save(&rdr->e820_digest);
> +	return 0;

Like I said, hibernation_e820_save() should just be inlined into here:

	rdr->e820_digest = compute_e820_crc32(e820_table_firmware)

Having the helper function doesn't add anything.

>  /**
> @@ -200,7 +155,7 @@ int arch_hibernation_header_restore(void *addr)
>  	jump_address_phys = rdr->jump_address_phys;
>  	restore_cr3 = rdr->cr3;
>  
> -	if (hibernation_e820_mismatch(rdr->e820_digest)) {
> +	if (hibernation_e820_mismatch(&rdr->e820_digest)) {

Likewise, this should be just

	if (rdr->e820_digest != compute_e820_crc32(e820_table_firmware)) {

- Eric

  reply	other threads:[~2021-04-13 20:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 16:13 Chris von Recklinghausen
2021-04-13 20:15 ` Eric Biggers [this message]
2021-04-13 20:28 ` Eric Biggers

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=YHX79XWnwaAGFtxq@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=crecklin@redhat.com \
    --cc=decui@microsoft.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=simo@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

all inboxes | Powered by JetHome®