Cert C rules errors

132 views Asked by At

We are checking code against cert rule and misra

I am getting: cert C issue PORTING.CAST.SIZE

void EDMADrv_setupChannel (uint8_t dmaChannel, const EDMADrv_TransferCfg* ptrTransferCfg)
{
    CSL_TpccRegs*      ptrEDMATPCCRegs;
    uint8_t                 tcc;
    uint16_t                paramId;
  paramId = (uint16_t)dmaChannel;//getting error from klocwork tool PORTING.CAST.SIZE ( Expression is cast to a type of potentially different size)

if assign

   uint16_t dmaChannelBit= dmaChannel;
   paramId = dmaChannelBit;

I get this error: STRONG.TYPE.ASSIGN.INIT (: A strongly typed value 'dmaChannel' of type 'uint8_t' is assigned to the variable 'dmaChannelBit' of a different strong type 'uint16_t')

can we ignore STRONG.TYPE.ASSIGN.INIT as we are assigning 8 bit to 16 bit . Or is there any other solution? can anyone tell if i ignore STRONG.TYPE.ASSIGN.INIT related issues .

0

There are 0 answers