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: [Qemu-devel] [PATCH] xen_console: support the new extend

To: Peter Maydell <peter.maydell@xxxxxxxxxx>
Subject: [Xen-devel] Re: [Qemu-devel] [PATCH] xen_console: support the new extended xenstore protocol
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Tue, 28 Jun 2011 15:21:22 +0100
Cc: Anthony Perard <anthony.perard@xxxxxxxxxx>, "agraf@xxxxxxx" <agraf@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "qemu-devel@xxxxxxxxxx" <qemu-devel@xxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Tue, 28 Jun 2011 07:17:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <BANLkTim0FdQy7FTbtrVOhvyugTMYPTTg6A@xxxxxxxxxxxxxx>
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: <1309260898-3518-1-git-send-email-stefano.stabellini@xxxxxxxxxxxxx> <BANLkTim0FdQy7FTbtrVOhvyugTMYPTTg6A@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Tue, 28 Jun 2011, Peter Maydell wrote:
> On 28 June 2011 12:34,  <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> > +    path = xs_get_domain_path(xs, domid);
> > +    if (path == NULL) {
> > +        fprintf(stderr, "xs_get_domain_path() error\n");
> > +        return -1;
> > +    }
> 
> Don't we need to call xs_daemon_close() on these error-exit paths?
> 
> > +    if (!xs_write(xs, XBT_NULL, path, pts, strlen(pts))) {
> > +        fprintf(stderr, "xs_write for '%s' fail", string);
> > +        return -1;
> > +    }
> 
> ...and this one's leaking the path string too.
> 
> > +void xenstore_store_pv_console_info(int i, CharDriverState *chr)
> > +{
> > +    char buf[32];
> > +
> > +    if (i == 0) {
> > +        snprintf(buf, sizeof(buf), "/console");
> > +        store_dev_info(xen_domid, chr, buf);
> 
> Am I missing something, or could you just pass "/console" straight
> to store_dev_info() without bothering to copy it into buf[] here?

All very good points as usual.
I'll send another patch with the error paths fixed and the useless
snprintf removed.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>