Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp463379imm; Wed, 19 Sep 2018 01:38:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdboqOmqPUYIRO6pYmCafVigmI9Uzj35TLwEPvGKiXQxGfglAyDaAG/eeLqoXYs8whutzbh1 X-Received: by 2002:a62:398c:: with SMTP id u12-v6mr35426007pfj.9.1537346290501; Wed, 19 Sep 2018 01:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537346290; cv=none; d=google.com; s=arc-20160816; b=ZMLRgpqMpueTCWEgmilutZbWnbcoXJDHyQ8FyaaoFVZKhg/pbMpNzBb63fYpsd6IWx D/Q3nrZBsncmkjoAlheX9dOd638Yt2ymNRfbM/RDExJ3UIsAkFuNsbo8C5v3xYrxh5lV Tir2gqIP37MbwPiBrZwJQ6x3/AvWM63QZFqwAePulMQPK8UQJlIejkmBCqK5SesZzncW Yy4gSXKaaIpJMSwTriSWUJBxE1qdLAzQsFYdWU18wjJ2pG9lATki5/mQUXoPPdvkNfow axnkmQvPFvdRmG8Xz6CNZQEVODEdzV5SYjHS552q7OEFMFegdB99Dr4U1299LR5iDv4p Xk+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=Ut1Sg8OlXKA7dKdCvFO/7KFBC7eHFfj3TfBx7eeS5Iw=; b=SHXIjNioW5IP8Tb1cdQS/4fo9qx2PCtWmx0TPifTJUDFqzyGEt6o7d4LY0R6kcCDoQ xDn6sQiweu0AcHEVkni0Evq2MObLIAS3i/TciHQzSaL0R6E50l7ASbPAQCzF8ZSDAbLK tQsUOOO5xS4eMo6sC2LXykM8nUm1OnwmmOFFNaxLYYToXMp8IWQXUlVesDdH1VMntzne u0vBvHuueDJzjlLLIJk7+kwEwMf3l3/3/ZHiTg6e/38W933ye0Kqtxftqwsxedy0f09L 7cZ1NWiyYWJV00YewE4ooHbhJwoMxXuHeGjNJfWPvoNVh9/yqwMrQXw6wzFurBuy5pVq dxfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6-v6si19425973pgb.469.2018.09.19.01.37.54; Wed, 19 Sep 2018 01:38:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730883AbeISOOB (ORCPT + 99 others); Wed, 19 Sep 2018 10:14:01 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:37205 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726972AbeISOOB (ORCPT ); Wed, 19 Sep 2018 10:14:01 -0400 Received: by mail-ot1-f67.google.com with SMTP id o13-v6so4935250otl.4; Wed, 19 Sep 2018 01:37:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ut1Sg8OlXKA7dKdCvFO/7KFBC7eHFfj3TfBx7eeS5Iw=; b=WV8QFuKhehDPecXVxB9ae6wdfuM8ARGKcEsom2UjLOH//r6iVkGRCmL/TdAHLby+Zf rPIPQHXnC6HEOu9wLjKcTBdh2hkUbm4M8I0zGTovnOYOiubfTb2EbhrodxFPnwsRujaB NGi+4r/RxfI+97NO9wM4tDoX+XiuXI/nN32YU6S6Lp4fYzYFI9zJ3E6K8ukbDbowX3Oj aJXl4W5PtOkeuaJPSPYoJLkJKQH/emfmHL58RtFfqCvbm2kXpcG3Y9O0OiKeHUspJQB2 lV2zzWfYZ7tmnyOzCsZ4zQFnuXedFbEB86C1/O1WcJ8owQGqZKRolzjsJOqg6F/1whlQ 2LYA== X-Gm-Message-State: APzg51AhVfbp5RfwiFapLWrECtBDGy1piLJniKbf/tC9q8FK8rbyAfmq PXBWnI9Nr5DY0o1KWOgYvP6WQN8s47rvqo8RgPw= X-Received: by 2002:a9d:19e8:: with SMTP id k95-v6mr19163979otk.248.1537346230459; Wed, 19 Sep 2018 01:37:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 19 Sep 2018 10:36:59 +0200 Message-ID: Subject: Re: [PATCH 02/12][RFC v3] PM / hibernate: Check the success of generating md5 digest before hibernation To: "Chen, Yu C" Cc: Thomas Gleixner , "Rafael J. Wysocki" , "the arch/x86 maintainers" , Linux Kernel Mailing List , Linux PM , Pavel Machek , Len Brown , kookoo.gu@intel.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 19, 2018 at 9:31 AM Chen Yu wrote: > > Currently if get_e820_md5() fails, then it will hibernate nevertheless. > Actually the error code should be propagated to upper caller so that > the hibernation could be aware of the result and terminates the process > if md5 digest fails. > > Suggested-by: Thomas Gleixner > Cc: "Rafael J. Wysocki" > Signed-off-by: Chen Yu > --- > arch/x86/power/hibernate_64.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c > index f8e3b668d20b..e0de959ad02d 100644 > --- a/arch/x86/power/hibernate_64.c > +++ b/arch/x86/power/hibernate_64.c > @@ -265,9 +265,9 @@ static int get_e820_md5(struct e820_table *table, void *buf) > return ret; > } > > -static void hibernation_e820_save(void *buf) > +static int hibernation_e820_save(void *buf) > { > - get_e820_md5(e820_table_firmware, buf); > + return get_e820_md5(e820_table_firmware, buf); > } > > static bool hibernation_e820_mismatch(void *buf) > @@ -287,8 +287,9 @@ static bool hibernation_e820_mismatch(void *buf) > return memcmp(result, buf, MD5_DIGEST_SIZE) ? true : false; > } > #else > -static void hibernation_e820_save(void *buf) > +static int hibernation_e820_save(void *buf) > { > + return 0; > } > > static bool hibernation_e820_mismatch(void *buf) > @@ -333,9 +334,7 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size) > > rdr->magic = RESTORE_MAGIC; > > - hibernation_e820_save(rdr->e820_digest); > - > - return 0; > + return hibernation_e820_save(rdr->e820_digest); > } > > /** > -- Reviewed-by: Rafael J. Wysocki