All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 2/2]xl: Check invalid domid in find_domain()
Date: Thu, 13 May 2010 17:36:34 +0800	[thread overview]
Message-ID: <4BEBC822.6080009@cn.fujitsu.com> (raw)

If domain id is invalid, find_domain should return error because
the specified domain does not exist.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>

diff -r a49dfaa986b0 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri May 14 01:27:26 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.c	Fri May 14 01:29:36 2010 +0800
@@ -137,7 +137,11 @@
         fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc);
         exit(2);
     }
-    common_domname = was_name ? p : 0;
+    common_domname = was_name ? p : libxl_domid_to_name(&ctx, domid);
+    if (!common_domname) {
+        fprintf(stderr, "%s is an invalid domain identifier.\n", p);
+        exit(2);
+    }
 }
 
 #define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)

-- 
Regards
Yang Hongyang

             reply	other threads:[~2010-05-13  9:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13  9:36 Yang Hongyang [this message]
2010-05-17 23:27 ` [PATCH 2/2]xl: Check invalid domid in find_domain() Jeremy Fitzhardinge
2010-05-18  1:18   ` Yang Hongyang
2010-05-18 17:01     ` Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BEBC822.6080009@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.