Date: Wed, 2 Jan 2008 04:12:35 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 132284 for review Message-ID: <200801020412.m024CZ2B003003@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132284 Change 132284 by kmacy@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801020412.m024CZ2B003003>