vec_size = 0;
KDBUS_ITEMS_FOREACH(item, msg->items, KDBUS_ITEMS_SIZE(msg, items)) {
size_t payload_size = KDBUS_ITEM_PAYLOAD_SIZE(item);
- struct iovec *iov = kmsg->iov + res->vec_count;
+ struct iovec *iov = kmsg->iov + kmsg->iov_count;
if (++n > KDBUS_MSG_MAX_ITEMS)
return -E2BIG;
iov->iov_len = size % 8;
}
- if (iov->iov_len > 0) {
- kmsg->pool_size += iov->iov_len;
- ++res->vec_count;
- }
-
+ kmsg->pool_size += iov->iov_len;
+ ++kmsg->iov_count;
+ ++res->vec_count;
++res->data_count;
vec_size += size;
iov->iov_len = size % 8;
kmsg->pool_size += iov->iov_len;
- ++res->vec_count;
+ ++kmsg->iov_count;
}
++res->data_count;
* @bloom_generation: Generation of bloom element set
* @notify_entry: List of kernel-generated notifications
* @iov: Array of iovec, describing the payload to copy
+ * @iov_count: Number of array members in @iov
* @pool_size: Overall size of inlined data referenced by @iov
* @meta: Appended SCM-like metadata of the sending process
* @res: Message resources
struct list_head notify_entry;
struct iovec *iov;
+ size_t iov_count;
u64 pool_size;
struct kdbus_meta *meta;
entry->meta = kdbus_meta_ref(kmsg->meta);
memcpy(&entry->msg, msg, sizeof(*msg));
- if (res && res->vec_count) {
+ if (kmsg->iov_count) {
size_t pool_avail = kdbus_pool_remain(pool);
/* do not give out more than half of the remaining space */
entry->slice_vecs = kdbus_pool_slice_alloc(pool,
kmsg->pool_size,
NULL, kmsg->iov,
- res->vec_count);
+ kmsg->iov_count);
if (IS_ERR(entry->slice_vecs)) {
ret = PTR_ERR(entry->slice_vecs);
entry->slice_vecs = NULL;