REQUEST SENSE 254->252 byte response
PATCH 1/1 REQUEST SENSE 254->252 byte response
SPC-3 (rev 13) says that 252 bytes in the maximum (and recommended) length for a REQUEST SENSE reponse.
Linux asks for 254 bytes in scsi_error.c .
That number was not specified in SPC-2 (although the allocation length field is 1 byte thus limiting it to 255). Seems as though some numbers are being rounded down to be multiples of 4.
Doug Gilbert
drivers/scsi/scsi_error.c2573dpg renamed from drivers/scsi/scsi_error.c +4 -4
@@ -532,14 +532,14 @@ static int scsi_request_sense(struct scsi_cmnd *scmd) { static unsigned char generic_sense[6] = - {REQUEST_SENSE, 0, 0, 0, 254, 0}; + {REQUEST_SENSE, 0, 0, 0, 252, 0}; unsigned char *scsi_result; int saved_result; int rtn; memcpy(scmd->cmnd, generic_sense, sizeof(generic_sense)); - scsi_result = kmalloc(254, GFP_ATOMIC | (scmd->device->host->hostt->unchecked_isa_dma) ? __GFP_DMA : 0); + scsi_result = kmalloc(252, GFP_ATOMIC | (scmd->device->host->hostt->unchecked_isa_dma) ? __GFP_DMA : 0); if (unlikely(!scsi_result)) {
@@ -555,11 +555,11 @@ * address (db). 0 is not a valid sense code. */ memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); - memset(scsi_result, 0, 254); + memset(scsi_result, 0, 252); saved_result = scmd->result; scmd->request_buffer = scsi_result; - scmd->request_bufflen = 254; + scmd->request_bufflen = 252; scmd->use_sg = 0; scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); scmd->sc_data_direction = SCSI_DATA_READ;