bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] xen: fix error handling


From: Samuel Thibault
Subject: Re: [PATCH 2/2] xen: fix error handling
Date: Thu, 20 Mar 2014 02:35:56 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Wed 19 Mar 2014 16:13:13 +0100, a écrit :
> Previously, the error KERN_RESOURCE_SHORTAGE was not properly
> propagated.
> 
> Found using the Clang Static Analyzer.

Ack.

> * xen/block.c (device_open): Fix error handling, remove unused label.
> * xen/net.c (device_open): Likewise.
> ---
>  xen/block.c | 5 ++---
>  xen/net.c   | 5 ++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/block.c b/xen/block.c
> index bd3758f..d98b31e 100644
> --- a/xen/block.c
> +++ b/xen/block.c
> @@ -382,8 +382,8 @@ device_open (ipc_port_t reply_port, mach_msg_type_name_t 
> reply_port_type,
>  
>       port = ipc_port_alloc_kernel();
>       if (port == IP_NULL) {
> -             err = KERN_RESOURCE_SHORTAGE;
> -             goto out;
> +             device_close(bd);
> +             return KERN_RESOURCE_SHORTAGE;
>       }
>       bd->port = port;
>  
> @@ -396,7 +396,6 @@ device_open (ipc_port_t reply_port, mach_msg_type_name_t 
> reply_port_type,
>       ipc_port_nsrequest (bd->port, 1, notify, &notify);
>       assert (notify == IP_NULL);
>  
> -out:
>       if (IP_VALID (reply_port))
>               ds_device_open_reply (reply_port, reply_port_type, D_SUCCESS, 
> port);
>       else
> diff --git a/xen/net.c b/xen/net.c
> index fb26471..5564365 100644
> --- a/xen/net.c
> +++ b/xen/net.c
> @@ -568,8 +568,8 @@ device_open (ipc_port_t reply_port, mach_msg_type_name_t 
> reply_port_type,
>  
>       port = ipc_port_alloc_kernel();
>       if (port == IP_NULL) {
> -             err = KERN_RESOURCE_SHORTAGE;
> -             goto out;
> +             device_close (nd);
> +             return KERN_RESOURCE_SHORTAGE;
>       }
>       nd->port = port;
>  
> @@ -582,7 +582,6 @@ device_open (ipc_port_t reply_port, mach_msg_type_name_t 
> reply_port_type,
>       ipc_port_nsrequest (nd->port, 1, notify, &notify);
>       assert (notify == IP_NULL);
>  
> -out:
>       if (IP_VALID (reply_port))
>               ds_device_open_reply (reply_port, reply_port_type, D_SUCCESS, 
> dev_to_port(nd));
>       else
> -- 
> 1.9.0
> 

-- 
Samuel
 > Voici mon problème, j'ai deux PCs relies par des cartes ethernet, 
 > configures avec le protocole PPP.
 -+- Romain in Guide du linuxien pervers - "Ils sont fous ces romains !" -+-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]