[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1316206180-6375-25-git-send-email-sandeen@redhat.com>
Date: Fri, 16 Sep 2011 15:49:39 -0500
From: Eric Sandeen <sandeen@...hat.com>
To: linux-ext4@...r.kernel.org
Cc: Eric Sandeen <sandeen@...hat.com>
Subject: [PATCH 24/25] e4defrag: Check error return of sysconf()
In theory sysconf() can fail, so check for an error return.
Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---
misc/e4defrag.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index eea3057..4ade180 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -399,13 +399,16 @@ static int calc_entry_counts(const char *file EXT2FS_ATTR((unused)),
static int page_in_core(int fd, struct move_extent defrag_data,
unsigned char **vec, unsigned int *page_num)
{
- long pagesize = sysconf(_SC_PAGESIZE);
+ long pagesize;
void *page = NULL;
loff_t offset, end_offset, length;
if (vec == NULL || *vec != NULL)
return -1;
+ pagesize = sysconf(_SC_PAGESIZE);
+ if (pagesize < 0)
+ return -1;
/* In mmap, offset should be a multiple of the page size */
offset = (loff_t)defrag_data.orig_start * block_size;
length = (loff_t)defrag_data.len * block_size;
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists