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

Re: [Xen-devel] [PATCH] xc: deal with xen/evtchn and xen/gntdev device n

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xc: deal with xen/evtchn and xen/gntdev device names
From: Bastian Blank <waldi@xxxxxxxxxx>
Date: Sat, 29 May 2010 08:53:42 +0200
Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 28 May 2010 23:54:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C00690B.2020303@xxxxxxxx>
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>
Mail-followup-to: Bastian Blank <waldi@xxxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
References: <4C00690B.2020303@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
On Fri, May 28, 2010 at 06:08:27PM -0700, Jeremy Fitzhardinge wrote:
> +     if (asprintf(&devname, "xen!%s", dev) == 0)
> +     if (asprintf(&devpath, "%s/%s", DEVXEN, dev) == 0)

asprintf is a glibc extension. Is it really necessary to support long
device names for fun or would some 64 byte on the stack be enough?

> +     devnum = xc_find_device_number(dev);
> +     if (devnum == -1)
> +             devnum = xc_find_device_number(devname);

Checks should always go from the special ("xen!...") to the gerneral.
Also the device is dev_t, not integer.

> +     /*
> +      * If we know what the correct device is and the path doesn't
> +      * exist or isn't a device, then remove it so we can create the
> +      * device.
> +      */
> +     if (devnum != -1 &&
> +             (stat(devpath, &st) != 0 || !S_ISCHR(st.st_mode))) {

Why should it exist and be something else then a character device? The
admin is free to break the system as she likes.

> +    fd = open(devpath, O_RDWR);

Whitespace.

Bastian

-- 
... bacteriological warfare ... hard to believe we were once foolish
enough to play around with that.
                -- McCoy, "The Omega Glory", stardate unknown

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

<Prev in Thread] Current Thread [Next in Thread>