Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Oct 2016 07:45: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: r307957 - stable/10/sys/cam/scsi
Message-ID:  <201610260745.u9Q7jmFB010114@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Oct 26 07:45:48 2016
New Revision: 307957
URL: https://svnweb.freebsd.org/changeset/base/307957

Log:
  MFC r307132: Use copyout() instead of pointing sbuf to user-space buffer.

Modified:
  stable/10/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_enc_ses.c	Wed Oct 26 07:45:15 2016	(r307956)
+++ stable/10/sys/cam/scsi/scsi_enc_ses.c	Wed Oct 26 07:45:48 2016	(r307957)
@@ -2675,13 +2675,13 @@ ses_get_elm_devnames(enc_softc_t *enc, e
 	if (len < 0)
 		return (EINVAL);
 
-	sbuf_new(&sb, elmdn->elm_devnames, len, 0);
-
 	cam_periph_unlock(enc->periph);
+	sbuf_new(&sb, NULL, len, SBUF_FIXEDLEN);
 	ses_paths_iter(enc, &enc->enc_cache.elm_map[elmdn->elm_idx],
 		       ses_elmdevname_callback, &sb);
 	sbuf_finish(&sb);
 	elmdn->elm_names_len = sbuf_len(&sb);
+	copyout(sbuf_data(&sb), elmdn->elm_devnames, elmdn->elm_names_len + 1);
 	cam_periph_lock(enc->periph);
 	return (elmdn->elm_names_len > 0 ? 0 : ENODEV);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610260745.u9Q7jmFB010114>