From 53fda7fef50d1a14d1871b721a1e6dda1645f241 Mon Sep 17 00:00:00 2001 From: Fathy Boundjadj Date: Sat, 18 Mar 2023 15:28:31 +0100 Subject: [PATCH] tweak safety doc --- src/submit.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/submit.rs b/src/submit.rs index 07b13e4f..03cbe403 100644 --- a/src/submit.rs +++ b/src/submit.rs @@ -194,10 +194,9 @@ impl<'a> Submitter<'a> { /// /// # Safety /// - /// This function is unsafe because improper use may lead to memory problems. - /// For example, a use-after-free may occur if `iov_base` contains a pointer freed - /// before unregistering the buffer through [`unregister_buffers`](Self::unregister_buffers) - /// or [`register_buffers_update_tag`](Self::register_buffers_update_tag). + /// Developers must ensure that the `iov_base` and `iov_len` values are valid and will + /// be valid until buffers are unregistered or the ring destroyed, otherwise undefined + /// behaviour may occur. pub unsafe fn register_buffers_update_tag( &self, off: u32, @@ -237,10 +236,9 @@ impl<'a> Submitter<'a> { /// /// # Safety /// - /// This function is unsafe because improper use may lead to memory problems. - /// For example, a use-after-free may occur if `iov_base` contains a pointer freed - /// before unregistering the buffer through [`unregister_buffers`](Self::unregister_buffers) - /// or [`register_buffers_update_tag`](Self::register_buffers_update_tag). + /// Developers must ensure that the `iov_base` and `iov_len` values are valid and will + /// be valid until buffers are unregistered or the ring destroyed, otherwise undefined + /// behaviour may occur. pub unsafe fn register_buffers_tags( &self, bufs: &[libc::iovec],