Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp270115imm; Thu, 20 Sep 2018 23:20:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYNjGvsB96hseKuRL8SIVri9gfIrBnTCbuMGkwk5qiGd3nC3jspmUJZHZIIJ+3gBiJb7SwM X-Received: by 2002:a17:902:a987:: with SMTP id bh7-v6mr43437947plb.182.1537510833586; Thu, 20 Sep 2018 23:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537510833; cv=none; d=google.com; s=arc-20160816; b=a+LVK3/PN1TLSBpLIPdvaIbtb32iKML5hx1h7KyAxuLyVc0obBcf7qjdUoMSeNlSo4 8TdBqU0JDe3acV4hPiOu5tnXqufD5IiqM6hP7vUdFjA6DpFWhUrf4zDupkfZcAv267dh gcJh8IaBjBNxkM4qjGKoguwDuvi8SYrzee5i/Lglfkyc8rnkpyuRVVbXXOCYgOogNNKV K6MsFHCzh3umsA4PUnw10jGIw9Mq7ITu3wYZVQ9rJNtSlfJO2gDUwcDFm2MB3W2Vluaw mkEe9b8ghKHtIxl6ibQS5lgqt0a2UBb+epe7kjNbiRiD2H5Te4NhsrdmFyJQDz53kVwb X2kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=mr85wGV1f1icHXBILQdEj/i/ewfxX2Vz0sYV3V6CuQ0=; b=Yu90I3XBG47zrrYBMdBJ4gZDGdy5BOdVu7xZN8/4uRUN5gVZa8DHJJ/P/cTbY6f65w 711oTLu/uGtVsIcxV/poRKuEJMHIhNI0bi7rhrQVSSxC06SiqpI+xx9hqGCDGcZ7z3+9 EscudD0abdXDh/ZPWZRnG3wmC+b3e9kalJB4PgWi/Xy3spkKSs5pWbJRNecXtfaLE9P+ JMs6sOmPDnI8o0B45NqwFb0iZxbIjbXIYc4F+LBSYOCjMJ+W9/k/KWAiKW9lUam/BwLm KKJw6EGS/3W5hdumHx6OvkFFFsUvVvFiWzqnDlHVwB3QIJl3KxSP6R8zfEAWU9/guJTV AzfQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 71-v6si24817686pfa.305.2018.09.20.23.20.17; Thu, 20 Sep 2018 23:20:33 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389327AbeIUMHQ (ORCPT + 99 others); Fri, 21 Sep 2018 08:07:16 -0400 Received: from mga04.intel.com ([192.55.52.120]:60156 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbeIUMHQ (ORCPT ); Fri, 21 Sep 2018 08:07:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2018 23:19:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,283,1534834800"; d="scan'208";a="74798785" Received: from chenyu-desktop.sh.intel.com ([10.239.160.116]) by orsmga007.jf.intel.com with ESMTP; 20 Sep 2018 23:19:52 -0700 From: Chen Yu To: Thomas Gleixner , "Rafael J. Wysocki" Cc: Pavel Machek , Len Brown , Zhimin Gu , Chen Yu , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/12][v4] PM / hibernate: Check the success of generating md5 digest before hibernation Date: Fri, 21 Sep 2018 14:26:38 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Pavel Machek Reviewed-by: 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); } /** -- 2.17.1