[CRIU] [PATCH 7/7] test/bers: Fix sizeof to memset

Rikard Falkeborn rikard.falkeborn at gmail.com
Sun Apr 28 21:22:55 MSK 2019


sizeof(fd) is the size of the pointer. Make sure the entire array is set
by using the number of elements times the size of the elements.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
---
 test/others/bers/bers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/others/bers/bers.c b/test/others/bers/bers.c
index 0954868f..90b70c34 100644
--- a/test/others/bers/bers.c
+++ b/test/others/bers/bers.c
@@ -138,7 +138,7 @@ static int create_files(shared_data_t *shared, int *fd, size_t nr_files)
 	char path[PATH_MAX];
 	size_t i;
 
-	memset(fd, 0xff, sizeof(fd));
+	memset(fd, 0xff, sizeof(*fd) * MAX_CHUNK);
 
 	pr_info("\tCreating %lu files\n", shared->opt_files);
 
-- 
2.21.0



More information about the CRIU mailing list