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

Changes for passing the Coverity Static Analysis #314

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

DakshitBabbar
Copy link
Member

Description

Make required changes for passing the Coverity Static Analysis. Unit tests are modified for the changes made.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@DakshitBabbar
Copy link
Member Author

There is some issue with the coverage report. Working on that.

const size_t vecLen = pVec->vectorLen;
size_t index = 0;
size_t i = 0;

for( i = 0; i < vecLen; i++ )
{
memcpy( &pAllocatedMem[ index ], pTransportVec[ i ].iov_base, pTransportVec[ i ].iov_len );
( void ) memcpy( &pAllocatedMem[ index ], ( const uint8_t * ) pTransportVec[ i ].iov_base, pTransportVec[ i ].iov_len );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Since memcpy's signature is: void* memcpy( void *dest, const void *src, size_t count );
wouldn't it be better to cast it to void/const void pointers.
For example, we do it like this in +TCP: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/source/FreeRTOS_DNS_Parser.c#L698-L704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants