[CRIU] Re: [PATCH] parasite: Simplify parasite command copying
Cyrill Gorcunov
gorcunov at openvz.org
Thu Oct 11 12:33:34 EDT 2012
On Thu, Oct 11, 2012 at 08:27:08PM +0400, Pavel Emelyanov wrote:
> On 10/11/2012 05:59 PM, Cyrill Gorcunov wrote:
> > No need for memcpy here, it's plain integer value
> > which need to be filled.
> >
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> > parasite-syscall.c | 3 ++-
> > 1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/parasite-syscall.c b/parasite-syscall.c
> > index 1118ef2..97eef7a 100644
> > --- a/parasite-syscall.c
> > +++ b/parasite-syscall.c
> > @@ -244,7 +244,8 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
> > regs = regs_orig;
> > }
> >
> > - memcpy(ctl->addr_cmd, &cmd, sizeof(cmd));
> > + /* Setup command */
> > + *(unsigned int *)ctl->addr_cmd = cmd;
>
> Better fix the addr_cmd type.
Here we go.
-------------- next part --------------
>From 6179f2c26f3305b7becde93ca1b0441a66f23021 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Thu, 11 Oct 2012 17:59:10 +0400
Subject: [PATCH] parasite: Simplify parasite command copying
No need for memcpy here, it's plain integer value
which need to be filled.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
include/parasite-syscall.h | 2 +-
parasite-syscall.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index 8338d3d..aad6565 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -17,7 +17,7 @@ struct parasite_ctl {
int signals_blocked;
- void * addr_cmd; /* addr for command */
+ unsigned int * addr_cmd; /* addr for command */
void * addr_args; /* address for arguments */
int tsock; /* transport socket for transfering fds */
};
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 1118ef2..0590a55 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -244,7 +244,8 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
regs = regs_orig;
}
- memcpy(ctl->addr_cmd, &cmd, sizeof(cmd));
+ /* Setup command */
+ *ctl->addr_cmd = cmd;
parasite_setup_regs(ctl->parasite_ip, ®s);
--
1.7.7.6
More information about the CRIU
mailing list