PERFORCE change 132284 for review
Kip Macy
kmacy at FreeBSD.org
Tue Jan 1 20:12:36 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=132284
Change 132284 by kmacy at pandemonium:kmacy:xen31 on 2008/01/02 04:12:09
add sanity checks in initialization sequence
Affected files ...
.. //depot/projects/xen31/sys/dev/xen/blkfront/blkfront.c#7 edit
Differences ...
==== //depot/projects/xen31/sys/dev/xen/blkfront/blkfront.c#7 (text+ko) ====
@@ -236,6 +236,7 @@
{
int err, vdevice, i;
struct blkfront_info *info;
+
/* FIXME: Use dynamic device id if this is not set. */
err = xenbus_scanf(XBT_NIL, dev->nodename,
@@ -250,6 +251,15 @@
xenbus_dev_fatal(dev, ENOMEM, "allocating info structure");
return ENOMEM;
}
+
+ /*
+ * XXX debug only
+ */
+ for (i = 0; i < sizeof(*info); i++)
+ if (((uint8_t *)info)[i] != 0)
+ panic("non-null memory");
+
+ info->shadow_free = 0;
info->xbdev = dev;
info->vdevice = vdevice;
info->connected = BLKIF_STATE_DISCONNECTED;
@@ -518,11 +528,12 @@
static inline int
GET_ID_FROM_FREELIST(struct blkfront_info *info)
{
- unsigned long free = info->shadow_free;
- KASSERT(free <= BLK_RING_SIZE, ("free %lu > RING_SIZE", free));
- info->shadow_free = info->shadow[free].req.id;
- info->shadow[free].req.id = 0x0fffffee; /* debug */
- return free;
+ unsigned long nfree = info->shadow_free;
+
+ KASSERT(nfree <= BLK_RING_SIZE, ("free %lu > RING_SIZE", nfree));
+ info->shadow_free = info->shadow[nfree].req.id;
+ info->shadow[nfree].req.id = 0x0fffffee; /* debug */
+ return nfree;
}
static inline void
More information about the p4-projects
mailing list