Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix collection of coverity errors #33899

Merged
merged 5 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cmsis_rtos_v1/cmsis_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int32_t osSignalClear(osThreadId thread_id, int32_t signals)
osEvent osSignalWait(int32_t signals, uint32_t millisec)
{
int retval, key;
osEvent evt;
osEvent evt = {0};
uint32_t time_delta_ms, timeout = millisec;
uint64_t time_stamp_start, hwclk_cycles_delta, time_delta_ns;

Expand Down
6 changes: 5 additions & 1 deletion subsys/logging/log_backend_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ int write_log_to_file(uint8_t *data, size_t length, void *ctx)
length = 0;
}

fs_sync(f);
rc = fs_sync(f);
if (rc < 0) {
/* Something is wrong */
goto on_error;
}
}

return length;
Expand Down
2 changes: 1 addition & 1 deletion subsys/modbus/modbus_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int modbus_raw_submit_rx(const int iface, const struct modbus_adu *adu)
ctx->rx_adu.unit_id = adu->unit_id;
ctx->rx_adu.fc = adu->fc;
memcpy(ctx->rx_adu.data, adu->data,
MIN(adu->length, CONFIG_MODBUS_BUFFER_SIZE));
MIN(adu->length, sizeof(ctx->rx_adu.data)));
k_work_submit(&ctx->server_work);

return 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/posix/common/src/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ void test_posix_pthread_error_condition(void)
EINVAL, "get datach state error");

/* Initialise thread attribute to ensure won't be return with init error */
pthread_attr_init(&attr);
zassert_false(pthread_attr_init(&attr),
"Unable to create pthread object attr");
zassert_false(pthread_attr_setschedpolicy(&attr, 0),
"set scheduling policy error");
zassert_false(pthread_attr_setschedpolicy(&attr, 1),
Expand Down
4 changes: 2 additions & 2 deletions tests/subsys/modbus/src/test_modbus_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int server_raw_cb(const int iface, const struct modbus_adu *adu)
tmp_adu.unit_id = adu->unit_id;
tmp_adu.fc = adu->fc;
memcpy(tmp_adu.data, adu->data,
MIN(adu->length, CONFIG_MODBUS_BUFFER_SIZE));
MIN(adu->length, sizeof(tmp_adu.data)));

LOG_HEXDUMP_DBG(tmp_adu.data, tmp_adu.length, "resp");
k_sem_give(&received);
Expand All @@ -51,7 +51,7 @@ int client_raw_cb(const int iface, const struct modbus_adu *adu)
tmp_adu.unit_id = adu->unit_id;
tmp_adu.fc = adu->fc;
memcpy(tmp_adu.data, adu->data,
MIN(adu->length, CONFIG_MODBUS_BUFFER_SIZE));
MIN(adu->length, sizeof(tmp_adu.data)));

LOG_HEXDUMP_DBG(tmp_adu.data, tmp_adu.length, "c->s");

Expand Down