There's a check in medop_request_bytes to return OK if the passed
request_sz is 0. I don't think that can ever happen, since that
request_sz comes from the max_request_sz parameter when the iterator is
created. It wouldn't make sense to pass 0.
Change-Id: Ia2c8fb6e56195bcab607c39e366c6b58b3411f8b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
BT_ASSERT(tc);
BT_ASSERT(medops.request_bytes);
BT_ASSERT(medops.borrow_stream);
BT_ASSERT(tc);
BT_ASSERT(medops.request_bytes);
BT_ASSERT(medops.borrow_stream);
+ BT_ASSERT(max_request_sz > 0);
+
BT_COMP_LOG_CUR_LVL(BT_LOG_DEBUG, log_level, self_comp,
"Creating CTF plugin message iterator: "
"trace-addr=%p, max-request-size=%zu, "
BT_COMP_LOG_CUR_LVL(BT_LOG_DEBUG, log_level, self_comp,
"Creating CTF plugin message iterator: "
"trace-addr=%p, max-request-size=%zu, "
bt_self_component *self_comp = ds_file->self_comp;
bt_logging_level log_level = ds_file->log_level;
bt_self_component *self_comp = ds_file->self_comp;
bt_logging_level log_level = ds_file->log_level;
- if (request_sz == 0) {
- goto end;
- }
+ BT_ASSERT(request_sz > 0);
/*
* Check if we have at least one memory-mapped byte left. If we don't,
/*
* Check if we have at least one memory-mapped byte left. If we don't,
+ BT_ASSERT(remaining_mmap_bytes(ds_file) > 0);
*buffer_sz = MIN(remaining_mmap_bytes(ds_file), request_sz);
*buffer_sz = MIN(remaining_mmap_bytes(ds_file), request_sz);
BT_ASSERT(ds_file->mmap_addr);
*buffer_addr = ((uint8_t *) ds_file->mmap_addr) + ds_file->request_offset_in_mapping;
BT_ASSERT(ds_file->mmap_addr);
*buffer_addr = ((uint8_t *) ds_file->mmap_addr) + ds_file->request_offset_in_mapping;
ds_file->request_offset_in_mapping += *buffer_sz;
goto end;
ds_file->request_offset_in_mapping += *buffer_sz;
goto end;
uint64_t len_left;
uint64_t read_len;
uint64_t len_left;
uint64_t read_len;
+ BT_ASSERT(request_sz);
+
if (stream->has_stream_hung_up) {
status = CTF_MSG_ITER_MEDIUM_STATUS_EOF;
goto end;
if (stream->has_stream_hung_up) {
status = CTF_MSG_ITER_MEDIUM_STATUS_EOF;
goto end;