summaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2018-06-25 13:30:58 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-07-02 11:48:30 +0200
commitd5641c64c48f4408500a348301bff01fbf2c1ec5 (patch)
treecec4b8bb9b9319b43a4bd0f2ddb0d61285800b47 /kernel/power
parent021c91791a5e7e85c567452f1be3e4c2c6cb6063 (diff)
PM / hibernate: cast PAGE_SIZE to int when comparing with error code
If PAGE_SIZE is unsigned type then negative error code will be larger than PAGE_SIZE. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/swap.c4
1 files 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);