Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102991841
D40428.id122897.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40428.id122897.diff
View Options
diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c
--- a/sys/opencrypto/criov.c
+++ b/sys/opencrypto/criov.c
@@ -321,6 +321,7 @@
break;
case CRYPTO_BUF_UIO:
cc->cc_iov = cb->cb_uio->uio_iov;
+ cc->cc_buf_len = cb->cb_uio->uio_resid;
break;
default:
#ifdef INVARIANTS
@@ -386,6 +387,7 @@
cc->cc_offset += amount;
break;
}
+ cc->cc_buf_len -= remain;
amount -= remain;
cc->cc_iov++;
cc->cc_offset = 0;
@@ -406,14 +408,34 @@
{
switch (cc->cc_type) {
case CRYPTO_BUF_CONTIG:
- *len = cc->cc_buf_len;
- return (cc->cc_buf);
+ case CRYPTO_BUF_UIO:
+ case CRYPTO_BUF_VMPAGE:
+ if (cc->cc_buf_len == 0) {
+ *len = 0;
+ return (NULL);
+ }
+ break;
case CRYPTO_BUF_MBUF:
case CRYPTO_BUF_SINGLE_MBUF:
if (cc->cc_mbuf == NULL) {
*len = 0;
return (NULL);
}
+ break;
+ default:
+#ifdef INVARIANTS
+ panic("%s: invalid buffer type %d", __func__, cc->cc_type);
+#endif
+ *len = 0;
+ return (NULL);
+ }
+
+ switch (cc->cc_type) {
+ case CRYPTO_BUF_CONTIG:
+ *len = cc->cc_buf_len;
+ return (cc->cc_buf);
+ case CRYPTO_BUF_MBUF:
+ case CRYPTO_BUF_SINGLE_MBUF:
if (cc->cc_mbuf->m_flags & M_EXTPG)
return (m_epg_segment(cc->cc_mbuf, cc->cc_offset, len));
*len = cc->cc_mbuf->m_len - cc->cc_offset;
@@ -426,11 +448,7 @@
*len = cc->cc_iov->iov_len - cc->cc_offset;
return ((char *)cc->cc_iov->iov_base + cc->cc_offset);
default:
-#ifdef INVARIANTS
- panic("%s: invalid buffer type %d", __func__, cc->cc_type);
-#endif
- *len = 0;
- return (NULL);
+ __assert_unreachable();
}
}
@@ -504,6 +522,7 @@
todo = MIN(remain, size);
memcpy(dst, src, todo);
src += todo;
+ cc->cc_buf_len -= todo;
if (todo < remain) {
cc->cc_offset += todo;
break;
@@ -593,6 +612,7 @@
todo = MIN(remain, size);
memcpy(dst, src, todo);
dst += todo;
+ cc->cc_buf_len -= todo;
if (todo < remain) {
cc->cc_offset += todo;
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 1:59 PM (21 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14738803
Default Alt Text
D40428.id122897.diff (1 KB)
Attached To
Mode
D40428: opencrypto: Handle end-of-cursor conditions in crypto_cursor_segment()
Attached
Detach File
Event Timeline
Log In to Comment