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

Pavel Emelyanov xemul at parallels.com
Thu Oct 11 12:51:14 EDT 2012


On 10/11/2012 08:33 PM, 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.
> 


The 
ctl->addr_cmd           = (void *)PARASITE_CMD_ADDR((unsigned long)ctl->local_map);
line looks strange after this fix.


More information about the CRIU mailing list