[SCSI] libsas: fix sense_buffer overrun
authorFUJITA Tomonori <tomof@acm.org>
Sat, 12 Jan 2008 17:20:18 +0000 (02:20 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Wed, 23 Jan 2008 17:29:26 +0000 (11:29 -0600)
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/libsas/sas_scsi_host.c

index b784089b18d072f51103ac460e295ce87eb0a79f..828fed1114ee823b4d26987eee1a64f0ad4a82d3 100644 (file)
@@ -108,7 +108,7 @@ static void sas_scsi_task_done(struct sas_task *task)
                        break;
                case SAM_CHECK_COND:
                        memcpy(sc->sense_buffer, ts->buf,
-                              max(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size));
+                              min(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size));
                        stat = SAM_CHECK_COND;
                        break;
                default: