[CRIU] Re: [PATCH] parasite: Simplify parasite command copying

Cyrill Gorcunov gorcunov at openvz.org
Thu Oct 11 12:35:32 EDT 2012


On Thu, Oct 11, 2012 at 08:33:34PM +0400, Cyrill Gorcunov wrote:
> 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.

It maybe make sense to drop cmd completely from
arguments lists since we have to prepare arguments
anyway. But it's a task for another time.


More information about the CRIU mailing list