[ipxe-devel] [PATCH 1/3] scsi: Improve sense code parsing

Michael Brown mcb30 at ipxe.org
Tue Jun 3 10:12:07 UTC 2014


On 03/06/14 08:18, Hannes Reinecke wrote:
> Sadly, it's not equivalent.
> My patch parsed the asc and ascq values, too.

So does this one: they are present as:

	/** Additional sense code and qualifier */
	uint16_t additional;

and displayed in

	DBGC ( scsidev, " sense %02x key %02x additional %04x\n",
	       ( response->sense.code & SCSI_SENSE_CODE_MASK ),
	       ( response->sense.key & SCSI_SENSE_KEY_MASK ),
	       ntohs ( response->sense.additional ) );

For example, with a non-existent LUN I get the message:

   SCSI 0xXXXXX tag YYYYYYYY status 02 sense 70 key 00 additional 2500

and table D.1 in SPC-4 shows this as meaning:

   25h 00h   DTLPWROMAEBKVF   LOGICAL UNIT NOT SUPPORTED

> What was wrong with my original patch?

It potentially read beyond the end of the packet, in the case of a 
malformed packet.  (This was a flaw in the original code as well, but a 
patch in that area should probably fix the problem rather than make it 
worse by potentially reading even further.)

Michael



More information about the ipxe-devel mailing list