diff mbox

[1/3] linux-user: fd_trans_*_data() returns the length

Message ID 1466531475-13389-2-git-send-email-laurent@vivier.eu (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Vivier June 21, 2016, 5:51 p.m. UTC
fd_trans_target_to_host_data() and fd_trans_host_to_target_data() must
return the length of processed data.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

Comments

Laurent Vivier June 28, 2016, 4:50 p.m. UTC | #1
Ping?

Laurent

Le 21/06/2016 à 19:51, Laurent Vivier a écrit :
> fd_trans_target_to_host_data() and fd_trans_host_to_target_data() must
> return the length of processed data.
> 
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/syscall.c | 36 ++++++++++++++++++++++++++++++++----
>  1 file changed, 32 insertions(+), 4 deletions(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 0082762..9a5cd26 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2821,12 +2821,26 @@ static TargetFdTrans target_packet_trans = {
>  #ifdef CONFIG_RTNETLINK
>  static abi_long netlink_route_target_to_host(void *buf, size_t len)
>  {
> -    return target_to_host_nlmsg_route(buf, len);
> +    abi_long ret;
> +
> +    ret = target_to_host_nlmsg_route(buf, len);
> +    if (ret < 0) {
> +        return ret;
> +    }
> +
> +    return len;
>  }
>  
>  static abi_long netlink_route_host_to_target(void *buf, size_t len)
>  {
> -    return host_to_target_nlmsg_route(buf, len);
> +    abi_long ret;
> +
> +    ret = host_to_target_nlmsg_route(buf, len);
> +    if (ret < 0) {
> +        return ret;
> +    }
> +
> +    return len;
>  }
>  
>  static TargetFdTrans target_netlink_route_trans = {
> @@ -2837,12 +2851,26 @@ static TargetFdTrans target_netlink_route_trans = {
>  
>  static abi_long netlink_audit_target_to_host(void *buf, size_t len)
>  {
> -    return target_to_host_nlmsg_audit(buf, len);
> +    abi_long ret;
> +
> +    ret = target_to_host_nlmsg_audit(buf, len);
> +    if (ret < 0) {
> +        return ret;
> +    }
> +
> +    return len;
>  }
>  
>  static abi_long netlink_audit_host_to_target(void *buf, size_t len)
>  {
> -    return host_to_target_nlmsg_audit(buf, len);
> +    abi_long ret;
> +
> +    ret = host_to_target_nlmsg_audit(buf, len);
> +    if (ret < 0) {
> +        return ret;
> +    }
> +
> +    return len;
>  }
>  
>  static TargetFdTrans target_netlink_audit_trans = {
>
Riku Voipio June 30, 2016, 7:52 a.m. UTC | #2
Hi,

I've merged the netlink patches the que[1]. I'm waiting to see if
we'll get some fixup patches to the fairly substantial changes
linux-user has seen in this cycle.

Riku

[1] https://git.linaro.org/people/riku.voipio/qemu.git/shortlog/refs/heads/linux-user-for-upstream
On Tue, Jun 28, 2016 at 06:50:20PM +0200, Laurent Vivier wrote:
> Ping?
> 
> Laurent
> 
> Le 21/06/2016 à 19:51, Laurent Vivier a écrit :
> > fd_trans_target_to_host_data() and fd_trans_host_to_target_data() must
> > return the length of processed data.
> > 
> > Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> > ---
> >  linux-user/syscall.c | 36 ++++++++++++++++++++++++++++++++----
> >  1 file changed, 32 insertions(+), 4 deletions(-)
> > 
> > diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> > index 0082762..9a5cd26 100644
> > --- a/linux-user/syscall.c
> > +++ b/linux-user/syscall.c
> > @@ -2821,12 +2821,26 @@ static TargetFdTrans target_packet_trans = {
> >  #ifdef CONFIG_RTNETLINK
> >  static abi_long netlink_route_target_to_host(void *buf, size_t len)
> >  {
> > -    return target_to_host_nlmsg_route(buf, len);
> > +    abi_long ret;
> > +
> > +    ret = target_to_host_nlmsg_route(buf, len);
> > +    if (ret < 0) {
> > +        return ret;
> > +    }
> > +
> > +    return len;
> >  }
> >  
> >  static abi_long netlink_route_host_to_target(void *buf, size_t len)
> >  {
> > -    return host_to_target_nlmsg_route(buf, len);
> > +    abi_long ret;
> > +
> > +    ret = host_to_target_nlmsg_route(buf, len);
> > +    if (ret < 0) {
> > +        return ret;
> > +    }
> > +
> > +    return len;
> >  }
> >  
> >  static TargetFdTrans target_netlink_route_trans = {
> > @@ -2837,12 +2851,26 @@ static TargetFdTrans target_netlink_route_trans = {
> >  
> >  static abi_long netlink_audit_target_to_host(void *buf, size_t len)
> >  {
> > -    return target_to_host_nlmsg_audit(buf, len);
> > +    abi_long ret;
> > +
> > +    ret = target_to_host_nlmsg_audit(buf, len);
> > +    if (ret < 0) {
> > +        return ret;
> > +    }
> > +
> > +    return len;
> >  }
> >  
> >  static abi_long netlink_audit_host_to_target(void *buf, size_t len)
> >  {
> > -    return host_to_target_nlmsg_audit(buf, len);
> > +    abi_long ret;
> > +
> > +    ret = host_to_target_nlmsg_audit(buf, len);
> > +    if (ret < 0) {
> > +        return ret;
> > +    }
> > +
> > +    return len;
> >  }
> >  
> >  static TargetFdTrans target_netlink_audit_trans = {
> >
Laurent Vivier June 30, 2016, 10:44 a.m. UTC | #3
Le 30/06/2016 à 09:52, Riku Voipio a écrit :
> 
> Hi,
> 
> I've merged the netlink patches the que[1]. I'm waiting to see if
> we'll get some fixup patches to the fairly substantial changes
> linux-user has seen in this cycle.

Perfect.

Thanks,
Laurent

> 
> Riku
> 
> [1] https://git.linaro.org/people/riku.voipio/qemu.git/shortlog/refs/heads/linux-user-for-upstream
> On Tue, Jun 28, 2016 at 06:50:20PM +0200, Laurent Vivier wrote:
>> Ping?
>>
>> Laurent
>>
>> Le 21/06/2016 à 19:51, Laurent Vivier a écrit :
>>> fd_trans_target_to_host_data() and fd_trans_host_to_target_data() must
>>> return the length of processed data.
>>>
>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>> ---
>>>  linux-user/syscall.c | 36 ++++++++++++++++++++++++++++++++----
>>>  1 file changed, 32 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>>> index 0082762..9a5cd26 100644
>>> --- a/linux-user/syscall.c
>>> +++ b/linux-user/syscall.c
>>> @@ -2821,12 +2821,26 @@ static TargetFdTrans target_packet_trans = {
>>>  #ifdef CONFIG_RTNETLINK
>>>  static abi_long netlink_route_target_to_host(void *buf, size_t len)
>>>  {
>>> -    return target_to_host_nlmsg_route(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = target_to_host_nlmsg_route(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static abi_long netlink_route_host_to_target(void *buf, size_t len)
>>>  {
>>> -    return host_to_target_nlmsg_route(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = host_to_target_nlmsg_route(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static TargetFdTrans target_netlink_route_trans = {
>>> @@ -2837,12 +2851,26 @@ static TargetFdTrans target_netlink_route_trans = {
>>>  
>>>  static abi_long netlink_audit_target_to_host(void *buf, size_t len)
>>>  {
>>> -    return target_to_host_nlmsg_audit(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = target_to_host_nlmsg_audit(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static abi_long netlink_audit_host_to_target(void *buf, size_t len)
>>>  {
>>> -    return host_to_target_nlmsg_audit(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = host_to_target_nlmsg_audit(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static TargetFdTrans target_netlink_audit_trans = {
>>>
Laurent Vivier July 7, 2016, 11:38 a.m. UTC | #4
Le 30/06/2016 à 09:52, Riku Voipio a écrit :
> 
> Hi,
> 
> I've merged the netlink patches the que[1]. I'm waiting to see if
> we'll get some fixup patches to the fairly substantial changes
> linux-user has seen in this cycle.
> 
> Riku
> 
> [1] https://git.linaro.org/people/riku.voipio/qemu.git/shortlog/refs/heads/linux-user-for-upstream

Ping?

Laurent

> On Tue, Jun 28, 2016 at 06:50:20PM +0200, Laurent Vivier wrote:
>> Ping?
>>
>> Laurent
>>
>> Le 21/06/2016 à 19:51, Laurent Vivier a écrit :
>>> fd_trans_target_to_host_data() and fd_trans_host_to_target_data() must
>>> return the length of processed data.
>>>
>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>> ---
>>>  linux-user/syscall.c | 36 ++++++++++++++++++++++++++++++++----
>>>  1 file changed, 32 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>>> index 0082762..9a5cd26 100644
>>> --- a/linux-user/syscall.c
>>> +++ b/linux-user/syscall.c
>>> @@ -2821,12 +2821,26 @@ static TargetFdTrans target_packet_trans = {
>>>  #ifdef CONFIG_RTNETLINK
>>>  static abi_long netlink_route_target_to_host(void *buf, size_t len)
>>>  {
>>> -    return target_to_host_nlmsg_route(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = target_to_host_nlmsg_route(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static abi_long netlink_route_host_to_target(void *buf, size_t len)
>>>  {
>>> -    return host_to_target_nlmsg_route(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = host_to_target_nlmsg_route(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static TargetFdTrans target_netlink_route_trans = {
>>> @@ -2837,12 +2851,26 @@ static TargetFdTrans target_netlink_route_trans = {
>>>  
>>>  static abi_long netlink_audit_target_to_host(void *buf, size_t len)
>>>  {
>>> -    return target_to_host_nlmsg_audit(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = target_to_host_nlmsg_audit(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static abi_long netlink_audit_host_to_target(void *buf, size_t len)
>>>  {
>>> -    return host_to_target_nlmsg_audit(buf, len);
>>> +    abi_long ret;
>>> +
>>> +    ret = host_to_target_nlmsg_audit(buf, len);
>>> +    if (ret < 0) {
>>> +        return ret;
>>> +    }
>>> +
>>> +    return len;
>>>  }
>>>  
>>>  static TargetFdTrans target_netlink_audit_trans = {
>>>
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0082762..9a5cd26 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2821,12 +2821,26 @@  static TargetFdTrans target_packet_trans = {
 #ifdef CONFIG_RTNETLINK
 static abi_long netlink_route_target_to_host(void *buf, size_t len)
 {
-    return target_to_host_nlmsg_route(buf, len);
+    abi_long ret;
+
+    ret = target_to_host_nlmsg_route(buf, len);
+    if (ret < 0) {
+        return ret;
+    }
+
+    return len;
 }
 
 static abi_long netlink_route_host_to_target(void *buf, size_t len)
 {
-    return host_to_target_nlmsg_route(buf, len);
+    abi_long ret;
+
+    ret = host_to_target_nlmsg_route(buf, len);
+    if (ret < 0) {
+        return ret;
+    }
+
+    return len;
 }
 
 static TargetFdTrans target_netlink_route_trans = {
@@ -2837,12 +2851,26 @@  static TargetFdTrans target_netlink_route_trans = {
 
 static abi_long netlink_audit_target_to_host(void *buf, size_t len)
 {
-    return target_to_host_nlmsg_audit(buf, len);
+    abi_long ret;
+
+    ret = target_to_host_nlmsg_audit(buf, len);
+    if (ret < 0) {
+        return ret;
+    }
+
+    return len;
 }
 
 static abi_long netlink_audit_host_to_target(void *buf, size_t len)
 {
-    return host_to_target_nlmsg_audit(buf, len);
+    abi_long ret;
+
+    ret = host_to_target_nlmsg_audit(buf, len);
+    if (ret < 0) {
+        return ret;
+    }
+
+    return len;
 }
 
 static TargetFdTrans target_netlink_audit_trans = {