From patchwork Mon Jun 25 05:30:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10485077 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 37DCE601D5 for ; Mon, 25 Jun 2018 05:31:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FEE028826 for ; Mon, 25 Jun 2018 05:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 245122884A; Mon, 25 Jun 2018 05:31:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD5D828826 for ; Mon, 25 Jun 2018 05:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751607AbeFYFbf (ORCPT ); Mon, 25 Jun 2018 01:31:35 -0400 Received: from mout.gmx.net ([212.227.17.20]:48189 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751238AbeFYFbe (ORCPT ); Mon, 25 Jun 2018 01:31:34 -0400 Received: from localhost.localdomain ([122.224.77.194]) by mail.gmx.com (mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MVvDo-1fdnHs2smG-00X1EX; Mon, 25 Jun 2018 07:31:21 +0200 From: Chengguang Xu To: rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH] kernel/power: cast PAGE_SIZE to int when comparing with error code Date: Mon, 25 Jun 2018 13:30:58 +0800 Message-Id: <20180625053058.25206-1-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.1 X-Provags-ID: V03:K1:0Y5TB6QQObgafKdCKhpsbL2pygV8JraO+7boIcTXrfEj2g/z0EH KKLMYTZswiahLTxspbhlrHIC3pOaEp82peI0wl1YchQ/DuhnYJy4XDYjZgpHO/lusLa+QTx yBa/El1m1822RptDWbtQlGpg7SBOkLe06CkoIGontLu1A2UhUW4oKLl4AATOfOEXt1XU725 PdNHevQx2gfc4IbcF/kNQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:aU4h/BOPr/k=:gIwsqgEMH2bgJbP9ncJvk7 e/m7VVVSsXuWi0Sa1fheHIN5J45d1YOWiK32qNci1q8ZbwNVd6IbVV6EObNLEu0Kkujsb7aLf jkjJL3nCk5PmOYKdwi2kiVYJSFmsY7uwgCtv7WBnqh+3BhihQyjV5ayvlFzxCCFps/CI8QAOq eAr6Ec6+kqxYt6bY1zhZaXFhzR9H7j9G+b0dqQzD3m8c2z/3kTtNxciSO8mVoAtO9xxkEp0QP xegqsosoAUFq9J/6zKuAtyckZugqcpwnMRQ5QHDFfvOo8VWrjsKtZScX4SgSnWg1FEKNJTySu poT3DkGLjse+EA5WnOIIuoMNgElgWzCB8Z1EEh7pKqChBALp+qFRfoe0zDZ8UUdjUxZ0rvnPa 8s9ZW5NlvfjUEbUC+aZujIqLpTzb2CLP+kdWNwJhVoQxmE3GYPsg5uHuGwkSYqfPNAU+LLKID fvacybGIHJB4SAQ52cooWjuMUp97qBVxPFrxBDhzEdt6dvrSTjj3RTNa4x8GvyRSPRafjfG4D 7bvICgMO0O/LrBfHw7ZvrWuqTHjqHFFJP8nBYXqeb4n6gtbXL7+SqBASh4WqyNtk0OTwgupE4 xtvlrPx+ER5yBCJPq7zft261P60oTBgWrCcMIiBNKmEnLgVK2xrX8aGqKivqHJxLdGhjX/4H4 tlVzmMgo1eKIwhpZtYtJZvl7J9tpH9dql+6I8s3I1daHTd1TO2tbw6amxz1u7BnuemXlFbE5k pd/e9777uox9NYP5a6wLs43Wgqd8eTiVYI0a06XIPkdjIWfKJLSwW4386WE= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If PAGE_SIZE is unsigned type then negative error code will be larger than PAGE_SIZE. Signed-off-by: Chengguang Xu --- kernel/power/swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/power/swap.c b/kernel/power/swap.c index c2bcf97d24c8..d7f6c1a288d3 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -923,7 +923,7 @@ int swsusp_write(unsigned int flags) } memset(&snapshot, 0, sizeof(struct snapshot_handle)); error = snapshot_read_next(&snapshot); - if (error < PAGE_SIZE) { + if (error < (int)PAGE_SIZE) { if (error >= 0) error = -EFAULT; @@ -1483,7 +1483,7 @@ int swsusp_read(unsigned int *flags_p) memset(&snapshot, 0, sizeof(struct snapshot_handle)); error = snapshot_write_next(&snapshot); - if (error < PAGE_SIZE) + if (error < (int)PAGE_SIZE) return error < 0 ? error : -EFAULT; header = (struct swsusp_info *)data_of(snapshot); error = get_swap_reader(&handle, flags_p);