From: Ian Campbell Subject: Re: [PATCH] minios: Fix xenbus_rm() calls in frontend drivers Date: Thu, 5 Sep 2013 10:17:21 +0100 Message-ID: <1378372641.14745.4.camel@kazak.uk.xensource.com> References: <1378340720-8653-1-git-send-email-msw@linux.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VHVgr-0001MZ-9U for xen-devel@lists.xenproject.org; Thu, 05 Sep 2013 09:17:25 +0000 In-Reply-To: <1378340720-8653-1-git-send-email-msw@linux.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Matt Wilson Cc: Ben Cressey , xen-devel@lists.xenproject.org, Stefano Stabellini , Matt Wilson , Samuel Thibault List-Id: xen-devel@lists.xenproject.org On Wed, 2013-09-04 at 17:25 -0700, Matt Wilson wrote: > From: Ben Cressey > > The commit "minios: refactor xenbus state machine" caused "/state" to > be appended to the local value of nodename. Previously the nodename > variable pointed to dev->nodename. > > The xenbus_rm() calls were not updated to reflect this change, and > refer to paths that do not exist. > > For example, shutdown_blkfront() for vbd 2049 would issue these calls: > xenbus_rm(XBT_NIL, "device/vbd/2049/state/ring-ref"); > xenbus_rm(XBT_NIL, "device/vbd/2049/state/event-channel"); > > This patch restores the previous behavior, issuing these calls > instead: > xenbus_rm(XBT_NIL, "device/vbd/2049/ring-ref"); > xenbus_rm(XBT_NIL, "device/vbd/2049/event-channel"); > > In addition, remove cases where the error message pointer is already > NULL and is then set to NULL. These are harmless, but suggest > incorrect practice: the pointer should be passed to free() to > deallocate memory prior to reassignment. Seems sensible to me. > Signed-off-by: Ben Cressey > Reviewed-by: Matt Wilson > Cc: Stefano Stabellini > Cc: Samuel Thibault > Signed-off-by: Matt Wilson > char path[strlen(dev->backend) + 1 + 5 + 1]; > - char nodename[strlen(dev->nodename) + 1 + 5 + 1]; > + char nodename[strlen(dev->nodename) + 1 + 13 + 1]; These changes don't seem to be covered by the commit message? I assume they relate to the length of the longest suffix which we are appending, perhaps using strlen("some-string-const") would make this more obvious?