Author: mav
Date: Wed Oct 12 08:25:13 2016
New Revision: 307132
URL: https://svnweb.freebsd.org/changeset/base/307132

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

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- head/sys/cam/scsi/scsi_enc_ses.c    Wed Oct 12 07:08:32 2016        
(r307131)
+++ head/sys/cam/scsi/scsi_enc_ses.c    Wed Oct 12 08:25:13 2016        
(r307132)
@@ -2672,13 +2672,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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to