Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/scsipi use correct size when copying outgoing sense ...



details:   https://anonhg.NetBSD.org/src/rev/516b4d63d334
branches:  trunk
changeset: 999375:516b4d63d334
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu May 30 16:57:39 2019 +0000

description:
use correct size when copying outgoing sense data.

diffstat:

 sys/dev/scsipi/scsipi_ioctl.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 554871d27bfd -r 516b4d63d334 sys/dev/scsipi/scsipi_ioctl.c
--- a/sys/dev/scsipi/scsipi_ioctl.c     Thu May 30 16:54:01 2019 +0000
+++ b/sys/dev/scsipi/scsipi_ioctl.c     Thu May 30 16:57:39 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsipi_ioctl.c,v 1.71 2019/05/26 08:12:41 mlelstv Exp $        */
+/*     $NetBSD: scsipi_ioctl.c,v 1.72 2019/05/30 16:57:39 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.71 2019/05/26 08:12:41 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.72 2019/05/30 16:57:39 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_freebsd.h"
@@ -168,14 +168,16 @@
                SC_DEBUG(periph, SCSIPI_DB3, ("have sense\n"));
                screq->senselen_used = uimin(sizeof(xs->sense.scsi_sense),
                    SENSEBUFLEN);
-               memcpy(screq->sense, &xs->sense.scsi_sense, screq->senselen);
+               memcpy(screq->sense, &xs->sense.scsi_sense,
+                   screq->senselen_used);
                screq->retsts = SCCMD_SENSE;
                break;
        case XS_SHORTSENSE:
                SC_DEBUG(periph, SCSIPI_DB3, ("have short sense\n"));
                screq->senselen_used = uimin(sizeof(xs->sense.atapi_sense),
                    SENSEBUFLEN);
-               memcpy(screq->sense, &xs->sense.scsi_sense, screq->senselen);
+               memcpy(screq->sense, &xs->sense.atapi_sense,
+                   screq->senselen_used);
                screq->retsts = SCCMD_UNKNOWN; /* XXX need a shortsense here */
                break;
        case XS_DRIVER_STUFFUP:



Home | Main Index | Thread Index | Old Index