WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] XEN: Make handle_vcpu_hotplug_event() to check t

To: wzt.wzt@xxxxxxxxx
Subject: [Xen-devel] Re: [PATCH] XEN: Make handle_vcpu_hotplug_event() to check the sscanf() return value
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Fri, 12 Mar 2010 16:39:28 -0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, jeremy@xxxxxxxxxxxxx
Delivery-date: Fri, 12 Mar 2010 16:40:00 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100312025324.GC2712@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20100312025324.GC2712@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3
On 03/11/2010 06:53 PM, wzt.wzt@xxxxxxxxx wrote:
It seems handle_vcpu_hotplug_event() not check the sscanf() return value.

Signed-off-by: Zhitong Wang<zhitong.wangzt@xxxxxxxxxxxxxxx>

Good catch, thanks.

    J

---
  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);
        }
  }



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] Re: [PATCH] XEN: Make handle_vcpu_hotplug_event() to check the sscanf() return value, Jeremy Fitzhardinge <=