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

Dmitry Safonov 0x7f454c46 at gmail.com
Mon Apr 29 17:59:49 MSK 2019


On Sun, 28 Apr 2019 at 19:45, Rikard Falkeborn
<rikard.falkeborn at gmail.com> wrote:
>
> 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>

We could set only nr_files instead of MAX_CHUNK, but it's a test,
so I don't actually mind setting the whole array. Thanks,
Reviewed-by: Dmitry Safonov <0x7f454c46 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
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu



-- 
             Dmitry


More information about the CRIU mailing list