diff --git a/platform/source/mbed_retarget.cpp b/platform/source/mbed_retarget.cpp index 6679d87219..61adeeb0f9 100644 --- a/platform/source/mbed_retarget.cpp +++ b/platform/source/mbed_retarget.cpp @@ -443,7 +443,7 @@ std::FILE *fdopen(FileHandle *fh, const char *mode) { // First reserve the integer file descriptor int fd = bind_to_fd(fh); - if (!fd) { + if (fd < 0) { return NULL; } // Then bind that to the C stream. If successful, C library @@ -825,6 +825,7 @@ int _lseek(FILEHANDLE fh, int offset, int whence) off_t off = lseek(fh, offset, whence); // Assuming INT_MAX = LONG_MAX, so we don't care about prototype difference + // coverity[result_independent_of_operands] if (off > INT_MAX) { // Be cautious in case off_t is 64-bit errno = EOVERFLOW; diff --git a/rtos/source/TARGET_CORTEX/rtx4/cmsis_os1.c b/rtos/source/TARGET_CORTEX/rtx4/cmsis_os1.c index a68eb0a1d8..ce0ca3f7be 100644 --- a/rtos/source/TARGET_CORTEX/rtx4/cmsis_os1.c +++ b/rtos/source/TARGET_CORTEX/rtx4/cmsis_os1.c @@ -267,6 +267,7 @@ osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id) { } ptr->mp_id = osMemoryPoolNew (queue_def->queue_sz, queue_def->item_sz, &queue_def->mp_attr); + // coverity[suspicious_sizeof] ptr->mq_id = osMessageQueueNew(queue_def->queue_sz, sizeof(void *), &queue_def->mq_attr); if ((ptr->mp_id == NULL) || (ptr->mq_id == NULL)) { if (ptr->mp_id != NULL) {