Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3489471imm; Sun, 24 Jun 2018 22:32:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKo3LvxVPDmd1RNr89uCGj8UmN7HlUlDLTDYPr+xmotW8KFoctbdgWAV8dA34y0XAHzG0Mk X-Received: by 2002:a17:902:a505:: with SMTP id s5-v6mr11105815plq.66.1529904749008; Sun, 24 Jun 2018 22:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529904748; cv=none; d=google.com; s=arc-20160816; b=vhgya5mp2cKow+AVZQqD+ujjJcyWCFd0m3P9GehL1NljJmKQLKQmcidL1LoQZxuxV1 0s4x0LJ1KC7XoZ9vONfxSOq858IfI6aOC2nt/3+0IWln0895VZQOipGDYz82VtegpePN uQFJEEdvsSKIgJZX+fIS8xdFTlijAWE40mf16FEYZQxjRq60O+oP/9fBpFZfWgxQIxrO R0kNd9oDN2ahDKZl85FWpYJl+s10zSFPSfRx8SE2OunsbUuLP8nuCN4XOVOxo4vMkzB7 St3Bxs4772+I15DQbojjRbnoitibpRsYMYpqKCIpXu5HkijFHoaiBFRH/sslBAdUavIA yCgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ui/Jjo1T0hz3u6+x++vimc+qtGpnsBiiErxSIBz05+Y=; b=eVd/w5rlib4TnLiCx5HnSJ//nZE+YuvEkLJvC9/JIjwKc1LwHA04YLFnJWxlEn9S67 o2DSTzMqv3XgGeRwqVdtYSBWEdW6ZGyqfOjsArQrBh/ISkNfQ1DXNF1TgCxjNEKm8f7k 69qci0tfP8RwqiHobfjSLuMoAIrngflSp4oYF++DEGk9COsaLUpz+TAN4hVtZiW+1/qg wq4n/7rL2VG1U397xx82DlAo/msR0Py5f8Cna6Wf+/bTWwBv9WZ74/oguXCl2+/+nyFd k5f1kuOXnjCxhXZsLmhTZ3zvlhNUoHga6kJKVxmfOKx4mzDqrmQrow5vjiM3Rwvgpbb4 mpfg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9-v6si12929404pla.59.2018.06.24.22.32.14; Sun, 24 Jun 2018 22:32:28 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbeFYFbg (ORCPT + 99 others); Mon, 25 Jun 2018 01:31:36 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.17.1