[CRIU] [PATCH 1/7] compel/s390: Fix memset sizeof

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


On Sun, 28 Apr 2019 at 19:45, Rikard Falkeborn
<rikard.falkeborn at gmail.com> wrote:
>
> sizeof(sizeof(x)) is the size of size_t. Instead use the size of the
> array to ensure the entire array is zeroed.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>

Nice find!

Reviewed-by: Dmitry Safonov <0x7f454c46 at gmail.com>

> ---
>  compel/arch/s390/src/lib/infect.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/compel/arch/s390/src/lib/infect.c b/compel/arch/s390/src/lib/infect.c
> index b690b812..fcb463fa 100644
> --- a/compel/arch/s390/src/lib/infect.c
> +++ b/compel/arch/s390/src/lib/infect.c
> @@ -148,10 +148,8 @@ int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe,
>                 memcpy(&dst_ext->vxrs_high, &fpregs->vxrs_high,
>                        sizeof(fpregs->vxrs_high));
>         } else {
> -               memset(&dst_ext->vxrs_low, 0,
> -                      sizeof(sizeof(fpregs->vxrs_low)));
> -               memset(&dst_ext->vxrs_high, 0,
> -                      sizeof(sizeof(fpregs->vxrs_high)));
> +               memset(&dst_ext->vxrs_low, 0, sizeof(dst_ext->vxrs_low));
> +               memset(&dst_ext->vxrs_high, 0, sizeof(dst_ext->vxrs_high));
>         }
>         return 0;
>  }
> --
> 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