Date: Wed, 23 Sep 2015 05:14:48 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288142 - stable/10/sys/cam/scsi Message-ID: <201509230514.t8N5EmWr044985@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Sep 23 05:14:48 2015 New Revision: 288142 URL: https://svnweb.freebsd.org/changeset/base/288142 Log: MFC r287866: Fix fixed sense writing when passed more data then it can fit. Modified: stable/10/sys/cam/scsi/scsi_all.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.c Wed Sep 23 05:13:49 2015 (r288141) +++ stable/10/sys/cam/scsi/scsi_all.c Wed Sep 23 05:14:48 2015 (r288142) @@ -3803,8 +3803,6 @@ scsi_set_sense_data_va(struct scsi_sense */ sense->extra_len = 10; sense_len = (int)va_arg(ap, int); - len_to_copy = MIN(sense_len, SSD_EXTRA_MAX - - sense->extra_len); data = (uint8_t *)va_arg(ap, uint8_t *); switch (elem_type) { @@ -3822,10 +3820,14 @@ scsi_set_sense_data_va(struct scsi_sense uint8_t *data_dest; int i; - if (elem_type == SSD_ELEM_COMMAND) + if (elem_type == SSD_ELEM_COMMAND) { data_dest = &sense->cmd_spec_info[0]; - else { + len_to_copy = MIN(sense_len, + sizeof(sense->cmd_spec_info)); + } else { 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509230514.t8N5EmWr044985>