We have to restrict the maximum length to less than 0xff. However, according to Kurt Garloff: Also, you probably send a 6 byte command, max alloc length would be 255, and we'd better round that down to 254 then. (Uneven counts on wide SCSI busses are a bit nasty and tend to trigger bugs in the LLDs w.r.t. handling of the IGNORE_RESIDUAL msg.) So we'll be using 254 throughout. Index: udev-021/extras/scsi_id/scsi_serial.c =================================================================== --- udev-021.orig/extras/scsi_id/scsi_serial.c 2004-03-03 01:01:32.000000000 +0100 +++ udev-021/extras/scsi_id/scsi_serial.c 2004-06-24 17:03:16.000000000 +0200 @@ -303,7 +303,7 @@ static int scsi_inquiry(struct sysfs_dev unsigned char *buffer; int retry = 3; /* rather random */ - if (buflen > 255) { + if (buflen > 254) { log_message(LOG_WARNING, "buflen %d too long\n", buflen); return -1; } @@ -356,6 +356,7 @@ resend: return retval; } +/* Get list of supported EVPD pages */ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, char *buffer, int len) { @@ -544,6 +561,7 @@ static int check_fill_0x83_id(struct sys return 0; } +/* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int len) { @@ -552,7 +570,7 @@ static int do_scsi_page83_inquiry(struct unsigned char page_83[256]; memset(page_83, 0, 256); - retval = scsi_inquiry(scsi_dev, fd, 1, 0x83, page_83, 255); + retval = scsi_inquiry(scsi_dev, fd, 1, 0x83, page_83, 254); if (retval < 0) return 1; @@ -601,6 +619,7 @@ static int do_scsi_page83_inquiry(struct return 1; } +/* Get unit serial number VPD page */ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int max_len) { @@ -611,7 +630,7 @@ static int do_scsi_page80_inquiry(struct unsigned char buf[256]; memset(buf, 0, 256); - retval = scsi_inquiry(scsi_dev, fd, 1, 0x80, buf, 255); + retval = scsi_inquiry(scsi_dev, fd, 1, 0x80, buf, 254); if (retval < 0) return retval; @@ -649,7 +668,8 @@ int scsi_get_serial (struct sysfs_device int ind; int retval; - if (len > 255) { + if (len > 254) { + len = 254; } memset(serial, 0, len); dprintf("opening %s\n", devname); @@ -686,7 +706,7 @@ int scsi_get_serial (struct sysfs_device * Get page 0, the page of the pages. By default, try from best to * worst of supported pages: 0x83 then 0x80. */ - if (do_scsi_page0_inquiry(scsi_dev, fd, page0, 255)) { + if (do_scsi_page0_inquiry(scsi_dev, fd, page0, 254)) { /* * Don't try anything else. Black list if a specific page * should be used for this vendor+model, or maybe have an