Only copy the minimum size of the two structs. I believe gcc
will recognize that these are constants so the resulting code
should be the same size and just as fast.

Signed-off-by: Matt Helsley <[email protected]>
---
 checkpoint/signal.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/checkpoint/signal.c b/checkpoint/signal.c
index 989b974..c65ee00 100644
--- a/checkpoint/signal.c
+++ b/checkpoint/signal.c
@@ -22,12 +22,12 @@
 
 static inline void fill_sigset(struct ckpt_sigset *h, sigset_t *sigset)
 {
-       memcpy(&h->sigset, sigset, sizeof(*sigset));
+       memcpy(&h->sigset, sigset, min(sizeof(*h), sizeof(*sigset)));
 }
 
 static inline void load_sigset(sigset_t *sigset, struct ckpt_sigset *h)
 {
-       memcpy(sigset, &h->sigset, sizeof(*sigset));
+       memcpy(sigset, &h->sigset, min(sizeof(*h), sizeof(*sigset)));
 }
 
 /***********************************************************************
-- 
1.6.3.3

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to