summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_all.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cam/scsi/scsi_all.c')
-rw-r--r--sys/cam/scsi/scsi_all.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index 995090c..3d5c323 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -4019,11 +4019,17 @@ scsi_set_sense_data_va(struct scsi_sense_data *sense_data,
data_dest = &sense->info[0];
len_to_copy = MIN(sense_len,
sizeof(sense->info));
- /*
- * We're setting the info field, so
- * set the valid bit.
- */
- sense->error_code |= SSD_ERRCODE_VALID;
+
+ /* Set VALID bit only if no overflow. */
+ for (i = 0; i < sense_len - len_to_copy;
+ i++) {
+ if (data[i] != 0)
+ break;
+ }
+ if (i >= sense_len - len_to_copy) {
+ sense->error_code |=
+ SSD_ERRCODE_VALID;
+ }
}
/*
OpenPOWER on IntegriCloud