[PATCH 3/3] libkmod: fix address argument to mmap calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The first argument to mmap should be "NULL" instead of "0".
---
 libkmod/libkmod-file.c  |    3 ++-
 libkmod/libkmod-index.c |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c
index 219c63b..5313796 100644
--- a/libkmod/libkmod-file.c
+++ b/libkmod/libkmod-file.c
@@ -255,7 +255,8 @@ static int load_reg(struct kmod_file *file)
 		return -errno;
 
 	file->size = st.st_size;
-	file->memory = mmap(0, file->size, PROT_READ, MAP_PRIVATE, file->fd, 0);
+	file->memory = mmap(NULL, file->size, PROT_READ, MAP_PRIVATE,
+			    file->fd, 0);
 	if (file->memory == MAP_FAILED)
 		return -errno;
 	file->direct = true;
diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c
index 516240e..d386f00 100644
--- a/libkmod/libkmod-index.c
+++ b/libkmod/libkmod-index.c
@@ -801,9 +801,9 @@ struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
 	if ((size_t) st.st_size < sizeof(hdr))
 		goto fail_nommap;
 
-	if ((idx->mm = mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0))
+	if ((idx->mm = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0))
 							== MAP_FAILED) {
-		ERR(ctx, "mmap(0, %"PRIu64", PROT_READ, %d, MAP_PRIVATE, 0): %m\n",
+		ERR(ctx, "mmap(NULL, %"PRIu64", PROT_READ, %d, MAP_PRIVATE, 0): %m\n",
 							st.st_size, fd);
 		goto fail_nommap;
 	}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux