diff options
Diffstat (limited to 'sys/dev/sym/sym_hipd.c')
-rw-r--r-- | sys/dev/sym/sym_hipd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index bc1ddcc..d4e1aca 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -7154,7 +7154,7 @@ static void sym_complete_error (hcb_p np, ccb_p cp) { struct ccb_scsiio *csio; u_int cam_status; - int i; + int i, sense_returned; SYM_LOCK_ASSERT(MA_OWNED); @@ -7214,11 +7214,15 @@ static void sym_complete_error (hcb_p np, ccb_p cp) * Bounce back the sense data to user and * fix the residual. */ - bzero(&csio->sense_data, csio->sense_len); + bzero(&csio->sense_data, sizeof(csio->sense_data)); + sense_returned = SYM_SNS_BBUF_LEN - csio->sense_resid; + if (sense_returned < csio->sense_len) + csio->sense_resid = csio->sense_len - + sense_returned; + else + csio->sense_resid = 0; bcopy(cp->sns_bbuf, &csio->sense_data, - MIN(csio->sense_len, SYM_SNS_BBUF_LEN)); - csio->sense_resid += csio->sense_len; - csio->sense_resid -= SYM_SNS_BBUF_LEN; + MIN(csio->sense_len, sense_returned)); #if 0 /* * If the device reports a UNIT ATTENTION condition |