diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2010-01-28 14:59:43 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-01-28 14:59:43 +0100 |
commit | be557fbac07b08e8614a0cf4468d2b489aba0f87 (patch) | |
tree | dfb14b40dd4f736fd80991d402d3246aec524d71 | |
parent | 25f150044b8c791d7c1696eaf6071b109ce3d940 (diff) | |
download | suspend-utils-be557fbac07b08e8614a0cf4468d2b489aba0f87.tar.gz |
Use direct 64-bit conversion when computing shift
In mark_swap() and reset_signature() in suspend.c and in
open_resume_dev() and reset_signature() in resume.c the value of
shift is computed as a 32-bit value (on 32-bit systems), so use
direct type casting to make it 64-bit.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Jakob Lell <jakob@cs.tu-berlin.de>
-rw-r--r-- | resume.c | 4 | ||||
-rw-r--r-- | suspend.c | 4 |
2 files changed, 4 insertions, 4 deletions
@@ -172,7 +172,7 @@ static int open_resume_dev(char *resume_dev_name, struct swsusp_header *swsusp_header) { ssize_t size = sizeof(struct swsusp_header); - off64_t shift = (resume_offset + 1) * page_size - size; + off64_t shift = ((off64_t)resume_offset + 1) * page_size - size; ssize_t ret; int fd; @@ -295,7 +295,7 @@ static int read_image(int dev, int fd, loff_t start) static int reset_signature(int fd, struct swsusp_header *swsusp_header) { ssize_t ret, size = sizeof(struct swsusp_header); - off64_t shift = (resume_offset + 1) * page_size - size; + off64_t shift = ((off64_t)resume_offset + 1) * page_size - size; int error = 0; /* Reset swap signature now */ @@ -1386,7 +1386,7 @@ static int mark_swap(int fd, loff_t start) { int error = 0; unsigned int size = sizeof(struct swsusp_header); - off64_t shift = (resume_offset + 1) * page_size - size; + off64_t shift = ((off64_t)resume_offset + 1) * page_size - size; if (lseek64(fd, shift, SEEK_SET) != shift) return -EIO; @@ -1625,7 +1625,7 @@ static int reset_signature(int fd) { int ret, error = 0; unsigned int size = sizeof(struct swsusp_header); - off64_t shift = (resume_offset + 1) * page_size - size; + off64_t shift = ((off64_t)resume_offset + 1) * page_size - size; if (lseek64(fd, shift, SEEK_SET) != shift) return -EIO; |