Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1486401
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH][v10] PM / hibernate: Verify the consistent of e820 memory map by md5 digest |
| Date | 2016-09-19 13:50 +0200 |
| Message-ID | <sj5fc-4Uq-5@gated-at.bofh.it> (permalink) |
| References | <sfsWK-2Il-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Sep 9, 2016 at 2:21 PM, Chen Yu <yu.c.chen@intel.com> wrote:
> On some platforms, there is occasional panic triggered when trying to
> resume from hibernation, a typical panic looks like:
[cut]
> @@ -211,10 +292,15 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size)
> */
> int arch_hibernation_header_restore(void *addr)
> {
> + bool e820_mismatch = false;
The extra local variable can be avoided if you structure the code
slightly differently.
> struct restore_data_record *rdr = addr;
>
> restore_jump_address = rdr->jump_address;
> jump_address_phys = rdr->jump_address_phys;
> restore_cr3 = rdr->cr3;
> - return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL;
> +
> + e820_mismatch = hibernation_e820_mismatch(rdr->e820_digest);
Also calling hibernation_e820_mismatch() before checking rdr->magic
may not be useful at all.
> +
> + return (rdr->magic == RESTORE_MAGIC) ?
> + (e820_mismatch ? -ENODEV : 0) : -EINVAL;
So what about:
if (rdr->magic != RESTORE_MAGIC)
return -EINVAL;
if (hibernation_e820_mismatch(rdr->e820_digest))
return -ENODEV;
return 0;
> }
> --
Thanks,
Rafael
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH][v10] PM / hibernate: Verify the consistent of e820 memory map by md5 digest "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-19 13:50 +0200
csiph-web