Suppress Coverity warnings

pull/11472/head
Hugues Kamba 2019-09-12 13:20:47 +01:00
parent 01bb1b94d7
commit 93f50eef3d
2 changed files with 3 additions and 1 deletions

View File

@ -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;

View File

@ -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) {