xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bastian Blank <waldi@debian.org>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Xen-devel <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] xc: deal with xen/evtchn and xen/gntdev device names
Date: Sat, 29 May 2010 08:53:42 +0200	[thread overview]
Message-ID: <20100529065342.GB12168@wavehammer.waldi.eu.org> (raw)
In-Reply-To: <4C00690B.2020303@goop.org>

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

  reply	other threads:[~2010-05-29  6:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-29  1:08 [PATCH] xc: deal with xen/evtchn and xen/gntdev device names Jeremy Fitzhardinge
2010-05-29  6:53 ` Bastian Blank [this message]
2010-06-01  7:56 ` Ian Campbell
2010-06-01  8:17   ` Bastian Blank
2010-06-01 16:35   ` Jeremy Fitzhardinge
2010-06-02  9:29     ` Ian Campbell
2010-06-02 16:09       ` Jeremy Fitzhardinge
2010-06-03  8:31         ` Ian Campbell
2010-06-03 19:32           ` Jeremy Fitzhardinge
2010-06-04  9:55             ` Ian Campbell
2010-06-04 10:01               ` Keir Fraser
2010-06-04 15:27               ` Dan Magenheimer
2010-06-04 15:31                 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100529065342.GB12168@wavehammer.waldi.eu.org \
    --to=waldi@debian.org \
    --cc=jeremy@goop.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).