Skip to content

Fix MISRA C 2012 Rule 10.8 violation #853

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

Merged
merged 6 commits into from
Nov 28, 2023

Conversation

chinglee-iot
Copy link
Member

@chinglee-iot chinglee-iot commented Oct 23, 2023

Fix MISRA C 2012 Rule 10.8 violation

Description

MISRA C:2012 Rule 10.8

The value of a composite expression shall not be cast to a different essential type category or a wider essential type.

MISRA violation
The following is an example of violation. uxItemSize and uxQueueLength is of UBaseType_t. The multiply result is still UBaseType_t. Convert UBaseType_t to size_t may cause implicit type conversion.

UBaseType_t uxQueueLength, uxItemSize;

xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize );

Fix In this PR

  • Update for composite expression of size_t type variables.

Test Steps

N/A

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.

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@1813a45). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #853   +/-   ##
=======================================
  Coverage        ?   93.64%           
=======================================
  Files           ?        6           
  Lines           ?     3179           
  Branches        ?      885           
=======================================
  Hits            ?     2977           
  Misses          ?       95           
  Partials        ?      107           
Flag Coverage Δ
unittests 93.64% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kar-rahul-aws kar-rahul-aws requested a review from a team as a code owner November 1, 2023 16:06
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@aggarg aggarg merged commit f2637ba into FreeRTOS:main Nov 28, 2023
@aggarg aggarg deleted the fix-misra-10.8 branch November 28, 2023 11:34
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