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

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


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>
---
 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



More information about the CRIU mailing list