Skip to content

Commit d5641c6

Browse files
Chengguang Xurafaeljw
authored andcommitted
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 <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 021c917 commit d5641c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/power/swap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ int swsusp_write(unsigned int flags)
923923
}
924924
memset(&snapshot, 0, sizeof(struct snapshot_handle));
925925
error = snapshot_read_next(&snapshot);
926-
if (error < PAGE_SIZE) {
926+
if (error < (int)PAGE_SIZE) {
927927
if (error >= 0)
928928
error = -EFAULT;
929929

@@ -1483,7 +1483,7 @@ int swsusp_read(unsigned int *flags_p)
14831483

14841484
memset(&snapshot, 0, sizeof(struct snapshot_handle));
14851485
error = snapshot_write_next(&snapshot);
1486-
if (error < PAGE_SIZE)
1486+
if (error < (int)PAGE_SIZE)
14871487
return error < 0 ? error : -EFAULT;
14881488
header = (struct swsusp_info *)data_of(snapshot);
14891489
error = get_swap_reader(&handle, flags_p);

0 commit comments

Comments
 (0)