From: Rusty Russell Subject: Re: [PATCH 1/2] Make shutdown use strings instead of codes Date: Sat, 06 Aug 2005 18:17:53 +1000 Message-ID: <1123316273.17152.5.camel@localhost.localdomain> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Smith Cc: "List: Xen Developers" List-Id: xen-devel@lists.xenproject.org On Fri, 2005-08-05 at 11:53 -0700, Dan Smith wrote: > This patch changes the shutdown driver and xend to use strings instead > of codes for signaling a shutdown request. Commenting on this: + unsigned int len; + + str = (char *)xenbus_read("control", "shutdown", &len); + + if (! len) { return; - }; + } xenbus_read will always nul-terminate the string it receives, and you should *never* test len as an indication of error! It should be: str = xenbus_read("control", "shutdown", NULL); if (IS_ERR(str)) return; Cheers! Rusty. -- A bad analogy is like a leaky screwdriver -- Richard Braakman