Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/allowed_urls.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://www.u-blox.com/en/product/sara-r4-series
https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main
with:
allowlist-file: '.github/allowed_urls.txt'

verify-manifest:
runs-on: ubuntu-latest
Expand Down
9 changes: 0 additions & 9 deletions MISRA.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@ _Ref 10.8.1_
and isdigit. We do not have control over these so we are suppressing these
violations.

#### Rule 11.3

_Ref 11.3.1_

- MISRA C-2012 Rule 11.3 does not allow casting of a pointer to different object
types. We are passing in a length variable which is then checked to determine
what to cast this value to. As such we are not worried about the chance of
misaligned access when using the cast variable.

#### Rule 21.6

_Ref 21.6.1_
Expand Down
18 changes: 3 additions & 15 deletions source/cellular_common_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,12 @@ static CellularError_t _socketSetSockOptLevelTransport( CellularSocketOption_t o
uint32_t optionValueLength )
{
CellularError_t cellularStatus = CELLULAR_SUCCESS;
const uint32_t * pTimeoutMs = NULL;

if( option == CELLULAR_SOCKET_OPTION_SEND_TIMEOUT )
{
if( optionValueLength == sizeof( uint32_t ) )
{
/* MISRA Ref 11.3 [Misaligned access] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/MISRA.md#rule-113 */
/* coverity[misra_c_2012_rule_11_3_violation] */
pTimeoutMs = ( const uint32_t * ) pOptionValue;
socketHandle->sendTimeoutMs = *pTimeoutMs;
( void ) memcpy( &( socketHandle->sendTimeoutMs ), pOptionValue, sizeof( uint32_t ) );
}
else
{
Expand All @@ -88,11 +83,7 @@ static CellularError_t _socketSetSockOptLevelTransport( CellularSocketOption_t o
{
if( optionValueLength == sizeof( uint32_t ) )
{
/* MISRA Ref 11.3 [Misaligned access] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/MISRA.md#rule-113 */
/* coverity[misra_c_2012_rule_11_3_violation] */
pTimeoutMs = ( const uint32_t * ) pOptionValue;
socketHandle->recvTimeoutMs = *pTimeoutMs;
( void ) memcpy( &( socketHandle->recvTimeoutMs ), pOptionValue, sizeof( uint32_t ) );
}
else
{
Expand All @@ -116,10 +107,7 @@ static CellularError_t _socketSetSockOptLevelTransport( CellularSocketOption_t o
{
if( ( socketHandle->socketState == SOCKETSTATE_ALLOCATED ) && ( optionValueLength == sizeof( uint16_t ) ) )
{
/* MISRA Ref 11.3 [Misaligned access] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/MISRA.md#rule-113 */
/* coverity[misra_c_2012_rule_11_3_violation] */
socketHandle->localPort = *( ( uint16_t * ) pOptionValue );
( void ) memcpy( &( socketHandle->localPort ), pOptionValue, sizeof( uint16_t ) );
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions test/unit-test/cellular_pkthandler_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
{ "RDY", cellularAtParseTokenHandler },
{ "RDY", cellularAtParseTokenHandler }
};
const uint32_t CellularUrcHandlerTableSize = sizeof( CellularUrcHandlerTable ) / sizeof( CellularAtParseTokenMap_t );
#define CellularUrcHandlerTableSize ( sizeof( CellularUrcHandlerTable ) / sizeof( CellularAtParseTokenMap_t ) )

CellularAtParseTokenMap_t CellularUrcHandlerTableWoParseFunc[] =
{
Expand All @@ -101,7 +101,7 @@ CellularAtParseTokenMap_t CellularUrcHandlerTableWoParseFunc[] =
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const uint32_t CellularUrcHandlerTableWoParseFuncSize = sizeof( CellularUrcHandlerTableWoParseFunc ) / sizeof( CellularAtParseTokenMap_t );
#define CellularUrcHandlerTableWoParseFuncSize ( sizeof( CellularUrcHandlerTableWoParseFunc ) / sizeof( CellularAtParseTokenMap_t ) )

CellularAtParseTokenMap_t CellularUrcHandlerTableSortFailCase[] =
{
Expand All @@ -116,7 +116,7 @@ CellularAtParseTokenMap_t CellularUrcHandlerTableSortFailCase[] =
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const uint32_t CellularUrcHandlerTableSortFailCaseSize = sizeof( CellularUrcHandlerTableSortFailCase ) / sizeof( CellularAtParseTokenMap_t );
#define CellularUrcHandlerTableSortFailCaseSize ( sizeof( CellularUrcHandlerTableSortFailCase ) / sizeof( CellularAtParseTokenMap_t ) )

CellularTokenTable_t tokenTable =
{
Expand Down
10 changes: 5 additions & 5 deletions test/unit-test/cellular_pktio_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,25 +162,25 @@ CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const uint32_t CellularUrcHandlerTableSize = sizeof( CellularUrcHandlerTable ) / sizeof( CellularAtParseTokenMap_t );
#define CellularUrcHandlerTableSize ( sizeof( CellularUrcHandlerTable ) / sizeof( CellularAtParseTokenMap_t ) )

const char * CellularSrcTokenErrorTable[] =
{ "ERROR", "BUSY", "NO CARRIER", "NO ANSWER", "NO DIALTONE", "ABORTED", "+CMS ERROR", "+CME ERROR", "SEND FAIL" };
const uint32_t CellularSrcTokenErrorTableSize = sizeof( CellularSrcTokenErrorTable ) / sizeof( char * );
#define CellularSrcTokenErrorTableSize ( sizeof( CellularSrcTokenErrorTable ) / sizeof( char * ) )

const char * CellularSrcTokenSuccessTable[] =
{ "OK", "CONNECT", "SEND OK", ">" };
const uint32_t CellularSrcTokenSuccessTableSize = sizeof( CellularSrcTokenSuccessTable ) / sizeof( char * );
#define CellularSrcTokenSuccessTableSize ( sizeof( CellularSrcTokenSuccessTable ) / sizeof( char * ) )

const char * CellularUrcTokenWoPrefixTable[] =
{ "NORMAL POWER DOWN", "PSM POWER DOWN", "RDY" };

const uint32_t CellularUrcTokenWoPrefixTableSize = sizeof( CellularUrcTokenWoPrefixTable ) / sizeof( char * );
#define CellularUrcTokenWoPrefixTableSize ( sizeof( CellularUrcTokenWoPrefixTable ) / sizeof( char * ) )

const char * CellularSrcExtraTokenSuccessTable[] =
{ "EXTRA_TOKEN_1", "EXTRA_TOKEN_2", "EXTRA_TOKEN_3" };

const uint32_t CellularSrcExtraTokenSuccessTableSize = sizeof( CellularSrcExtraTokenSuccessTable ) / sizeof( char * );
#define CellularSrcExtraTokenSuccessTableSize ( sizeof( CellularSrcExtraTokenSuccessTable ) / sizeof( char * ) )

CellularTokenTable_t tokenTable =
{
Expand Down
Loading