All of lore.kernel.org
 help / color / mirror / Atom feed
From: wzt.wzt@gmail.com
To: linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xensource.com, jeremy@xensource.com
Subject: [PATCH] XEN: Make handle_vcpu_hotplug_event() to check the sscanf() return value
Date: Fri, 12 Mar 2010 10:53:24 +0800	[thread overview]
Message-ID: <20100312025324.GC2712@localhost.localdomain> (raw)

It seems handle_vcpu_hotplug_event() not check the sscanf() return value.

Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>

---
 drivers/xen/cpu_hotplug.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
index 14e2d99..99773a6 100644
--- a/drivers/xen/cpu_hotplug.c
+++ b/drivers/xen/cpu_hotplug.c
@@ -69,8 +69,8 @@ static void handle_vcpu_hotplug_event(struct xenbus_watch *watch,
 
 	cpustr = strstr(node, "cpu/");
 	if (cpustr != NULL) {
-		sscanf(cpustr, "cpu/%u", &cpu);
-		vcpu_hotplug(cpu);
+		if (sscanf(cpustr, "cpu/%u", &cpu) == 1)
+			vcpu_hotplug(cpu);
 	}
 }
 
-- 
1.6.5.3


             reply	other threads:[~2010-03-12  2:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12  2:53 wzt.wzt [this message]
2010-03-13  0:39 ` [PATCH] XEN: Make handle_vcpu_hotplug_event() to check the sscanf() return value 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=20100312025324.GC2712@localhost.localdomain \
    --to=wzt.wzt@gmail.com \
    --cc=jeremy@xensource.com \
    --cc=linux-kernel@vger.kernel.org \
    --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.