Again, use offsetof() instead of a constant to enhance readability.
authorPeter Avalos <pavalos@dragonflybsd.org>
Wed, 28 Nov 2007 22:27:57 +0000 (22:27 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Wed, 28 Nov 2007 22:27:57 +0000 (22:27 +0000)
Obtained-from: FreeBSD

sys/bus/cam/cam_xpt.c

index 007b29f..086402f 100644 (file)
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/cam/cam_xpt.c,v 1.80.2.18 2002/12/09 17:31:55 gibbs Exp $
- * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.47 2007/11/28 22:21:48 pavalos Exp $
+ * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.48 2007/11/28 22:27:57 pavalos Exp $
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -5616,7 +5616,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
                        switch(periph_qual) {
                        case SID_QUAL_LU_CONNECTED:
                        {
-                               u_int8_t alen;
+                               u_int8_t len;
 
                                /*
                                 * We conservatively request only
@@ -5628,9 +5628,11 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
                                 * the amount of information the device
                                 * is willing to give.
                                 */
-                               alen = inq_buf->additional_length;
+                               len = inq_buf->additional_length
+                                   + offsetof(struct scsi_inquiry_data,
+                                               additional_length) + 1;
                                if (softc->action == PROBE_INQUIRY
-                                && alen > (SHORT_INQUIRY_LENGTH - 5)) {
+                                && len > SHORT_INQUIRY_LENGTH) {
                                        softc->action = PROBE_FULL_INQUIRY;
                                        xpt_release_ccb(done_ccb);
                                        xpt_schedule(periph, priority);