Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp409426imm; Wed, 19 Sep 2018 00:33:30 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdam+j50pNEp25eW9wX3+yaJ21JtiBGtqoNHXfKoUzTffXZLal2RqjPTg65E4ZOWEPENa1D5 X-Received: by 2002:a62:565c:: with SMTP id k89-v6mr34592107pfb.212.1537342410324; Wed, 19 Sep 2018 00:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537342410; cv=none; d=google.com; s=arc-20160816; b=kP9xTJtUMGPj3aiNSi2mE0phUdldh8tr+x+4PbA1jD1hRwpA8SSoCv9IUZV+GSicOQ pge6HS3QSUR0P3Hd9297pNqlniVGhwqZDMi3nvfgLm2+EWb2Nv10B0KYI5q7n6Ue6Kik ArcQsga2DXK2xNZwbAltI95TGy4rAHrBmmgrt/P1N8+nBgtc5HNyJPuZy5bLFeEOSK71 zKV459MR6G8G7AKWW23CE6AA1yPMkrDzXh5oYc9TKFuOKn1nYaRFuAK/kYFYEj5u2Oa7 /pTM7dErLAamQK6ZIXiKat97/2Y738OnBpJEa3WrKYYJdw+F3cPDm0Q6x/7tqDigLpDl t2aw== 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=d83+R4lhq1PUq/xRy0fzr1hDhH7pYIEAYe99AEMSmLw=; b=Jb1iJV01hL9KHEH5lCPV6t9jfLFpSP4WIWqDXPeNtyj7S8zNoAeR9DLiYl+pe+IU+l Iyvyx2aeEo02oven7kW3wO6UmMreuUNLMBl/LBpq6I3sgsuobF59XjOoWEZmptm5PlEI 1pJCJ/w8EZ6DQ5UJbmgyzLQgBnAWXs6Gl82gMxoIbKarwX9wPh04a0ewE5euDTrszaUC kqo7eLdmAd0ou3FCIpVPqiSH3pa36XI+uSwN9UiNmh4+sPeJM9vnKw5xODx5bf1cb23P E9seU9yPLnCrZTh3DSuOu02Ib31uLb+4SRP7UtfhR/bD14HeXOXddyiDENN6jF+ovBBr 76iQ== 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 k190-v6si19722396pgd.80.2018.09.19.00.33.14; Wed, 19 Sep 2018 00:33:30 -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 S1730997AbeISNIQ (ORCPT + 99 others); Wed, 19 Sep 2018 09:08:16 -0400 Received: from mga09.intel.com ([134.134.136.24]:11818 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbeISNIQ (ORCPT ); Wed, 19 Sep 2018 09:08:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2018 00:31:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,393,1531810800"; d="scan'208";a="91367351" Received: from chenyu-desktop.sh.intel.com ([10.239.160.116]) by fmsmga001.fm.intel.com with ESMTP; 19 Sep 2018 00:31:32 -0700 From: Chen Yu To: Thomas Gleixner , "Rafael J. Wysocki" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Pavel Machek , Len Brown , Zhimin Gu , Yu Chen Subject: [PATCH 02/12][RFC v3] PM / hibernate: Check the success of generating md5 digest before hibernation Date: Wed, 19 Sep 2018 15:38:17 +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 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); } /** -- 2.17.1