--- linux-2.5.70/drivers/scsi/scsi_scan.c 2003-05-27 03:00:46.000000000 +0200 +++ linux-2.5.70a/drivers/scsi/scsi_scan.c 2003-06-13 15:54:22.000000000 +0200 @@ -884,8 +884,8 @@ lun = 0; for (i = 0; i < sizeof(lun); i += 2) - lun = lun | (((scsilun->scsi_lun[i] << 8) | - scsilun->scsi_lun[i + 1]) << (i * 8)); + lun = lun | (((scsilun->scsi_lun[i] & 0x3f) << (i * 8 + 1)) | + ((scsilun->scsi_lun[i + 1]) << (i * 8))); return lun; } @@ -1027,13 +1027,18 @@ * the header, so start at 1 and go up to and including num_luns. */ for (lunp = &lun_data[1]; lunp <= &lun_data[num_luns]; lunp++) { + int j; + lun = scsilun_to_int(lunp); /* * Check if the unused part of lunp is non-zero, and so * does not fit in lun. */ - if (memcmp(&lunp->scsi_lun[sizeof(lun)], "\0\0\0\0", 4)) { + for (j = sizeof(lun); j < sizeof(struct scsi_lun); j++) + if (lunp->scsi_lun[j] != 0) + break; + if (j < sizeof(struct scsi_lun)) { int i; /*