diff mbox

[v2,7/7] libxl: fix error message in local_device_attach_cb

Message ID 1456428318-8318-8-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné Feb. 25, 2016, 7:25 p.m. UTC
The fields that are printed might not be set in the case of a failure, which
generates a segmentation fault.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Wei Liu March 1, 2016, 12:40 p.m. UTC | #1
On Thu, Feb 25, 2016 at 08:25:18PM +0100, Roger Pau Monne wrote:
> The fields that are printed might not be set in the case of a failure, which
> generates a segmentation fault.
> 

Right, I can see how this can fail.

In device_addrm_aocomplete we check if aodev is set. But I think that's
a bit overkill for local attach.

> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/libxl/libxl.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index d55c699..d5a0a01 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -3144,10 +3144,7 @@ static void local_device_attach_cb(libxl__egc *egc, libxl__ao_device *aodev)
>  
>      rc = aodev->rc;
>      if (rc) {
> -        LOGE(ERROR, "unable to %s %s with id %u",
> -                    libxl__device_action_to_string(aodev->action),
> -                    libxl__device_kind_to_string(aodev->dev->kind),
> -                    aodev->dev->devid);
> +        LOGE(ERROR, "unable locally attach device: %s", disk->pdev_path);
>          goto out;
>      }
>  
> -- 
> 2.5.4 (Apple Git-61)
>
diff mbox

Patch

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index d55c699..d5a0a01 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3144,10 +3144,7 @@  static void local_device_attach_cb(libxl__egc *egc, libxl__ao_device *aodev)
 
     rc = aodev->rc;
     if (rc) {
-        LOGE(ERROR, "unable to %s %s with id %u",
-                    libxl__device_action_to_string(aodev->action),
-                    libxl__device_kind_to_string(aodev->dev->kind),
-                    aodev->dev->devid);
+        LOGE(ERROR, "unable locally attach device: %s", disk->pdev_path);
         goto out;
     }