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

[IPv6] Fix coverity #933

Merged
merged 6 commits into from
Jun 26, 2023
Merged

Conversation

ActoryOu
Copy link
Member

@ActoryOu ActoryOu commented Jun 20, 2023

[IPv6] Fix coverity

Description

Fix coverity violations introduced recently.

  • DEADCODE in FreeRTOS_Routing.c line 824-838.
  • MISRA C-2012 Rule 10.4 in FreeRTOS_RA.c line 270.
  • MISRA C-2012 Rule 10.8 in FreeRTOS_IP_Utils.c line 433.
  • MISRA C-2012 Rule 11.3 in FreeRTOS_TCP_State_Handling_IPV4.c line 88-90.
  • MISRA C-2012 Rule 11.9 in FreeRTOS_Routing.c line 743.
  • MISRA C-2012 Rule 14.2 in FreeRTOS_ND.c line 237.
  • MISRA C-2012 Rule 17.2 in FreeRTOS_Sockets.c line 4636-4639.
  • MISRA C-2012 Rule 21.6 in FreeRTOS_Routing.c line 1522-1524.
  • MISRA C-2012 Rule 8.13 in:
  • MISRA C-2012 Rule 9.2 in FreeRTOS_DNS_Cache.c line 54 + FreeRTOS_IP.c line 530-535.
  • MISRA C-2012 Rule 9.3 in FreeRTOS_Routing.c line 743-744.
  • MISRA C-2012 Rule 11.3 in FreeRTOS_ARP.c line 1471.
  • MISRA C-2012 Rule 15.7 inFreeRTOS_DHCPv6.c line 354.

Test Steps

cov-configure --force --compiler cc --comptype gcc  -- -m32 -std=gnu90

cmake -B build -S test/Coverity

cd build/
cp ../test/Coverity/coverity_misra.config .

cov-build --emit-complementary-info --dir cov-out make

cd cov-out/
cov-analyze --dir . --coding-standard-config ../coverity_misra.config --tu-pattern "file('.*/FreeRTOS-Plus-TCP/source/.*')"

cov-format-errors --dir . --exclude-files '(.*/FreeRTOS-Kernel/.*)' --html-output html-output

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.

#if ( ipconfigUSE_IPv4 != 0 )
case ( BaseType_t ) pdFALSE:

case ( BaseType_t ) pdFALSE:
Copy link
Member

Choose a reason for hiding this comment

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

I think we decided not to do these kind of declaration. @tony-josi-aws to take a look.

Copy link
Member Author

@ActoryOu ActoryOu Jun 21, 2023

Choose a reason for hiding this comment

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

This is detected as DEADCODE by Coverity. xIsIPv6 is set to either pdTRUE or pdFALSE in the top of this function. It's impossible to enter default case when IPv4/IPv6 are both enabled (which we use in coverity scanning). But it's still possible in differnt configuration (for example, IPv4 only). So we need to keep it in the code.

Copy link
Member

Choose a reason for hiding this comment

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

I think the only alternative is to take a MISRA exception here, but I believe this looks better than taking exception.

@moninom1 moninom1 merged commit 04afe5f into FreeRTOS:dev/IPv6_integration Jun 26, 2023
8 checks passed
@ActoryOu ActoryOu deleted the MISRA_0620 branch June 29, 2023 07:36
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.

4 participants