Skip to content
  • Stefan Hajnoczi's avatar
    302a0d3e
    hw/9pfs: replace iovec manipulation with QEMUIOVector · 302a0d3e
    Stefan Hajnoczi authored
    
    
    The v9fs_read() and v9fs_write() functions rely on iovec[] manipulation
    code should be replaced with QEMUIOVector to avoid duplicating code.
    In the future it may be possible to make the code even more concise by
    using QEMUIOVector consistently across virtio and 9pfs.
    
    The "v" format specifier for pdu_marshal() and pdu_unmarshal() is
    dropped since it does not actually pack/unpack anything.  The specifier
    was also not implemented to update the offset variable and could only be
    used at the end of a format string, another sign that this shouldn't
    really be a format specifier.  Instead, see the new
    v9fs_init_qiov_from_pdu() function.
    
    This change avoids a possible iovec[] buffer overflow when indirect
    vrings are used since the number of vectors is now limited by the
    underlying VirtQueueElement and cannot be out-of-bounds.
    
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
    Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    302a0d3e
    hw/9pfs: replace iovec manipulation with QEMUIOVector
    Stefan Hajnoczi authored
    
    
    The v9fs_read() and v9fs_write() functions rely on iovec[] manipulation
    code should be replaced with QEMUIOVector to avoid duplicating code.
    In the future it may be possible to make the code even more concise by
    using QEMUIOVector consistently across virtio and 9pfs.
    
    The "v" format specifier for pdu_marshal() and pdu_unmarshal() is
    dropped since it does not actually pack/unpack anything.  The specifier
    was also not implemented to update the offset variable and could only be
    used at the end of a format string, another sign that this shouldn't
    really be a format specifier.  Instead, see the new
    v9fs_init_qiov_from_pdu() function.
    
    This change avoids a possible iovec[] buffer overflow when indirect
    vrings are used since the number of vectors is now limited by the
    underlying VirtQueueElement and cannot be out-of-bounds.
    
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
    Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Loading