Uploaded image for project: 'Sitara MPU & SPMCU SDKs'
  1. Sitara MPU & SPMCU SDKs
  2. EXT_SITMPUSW-5

Potential Infinite loop in OSPI_utilLog2 defined in ospi_v0.c

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • SITSW-4867
    • 09.02.00
    • 10.01.00
    • Hide
      am62xx-sk
      am62xx-sk-lp
      am62x-sip-sk
      am62a-sk
      am62p-sk
      Show
      am62xx-sk am62xx-sk-lp am62x-sip-sk am62a-sk am62p-sk

      OSPI_utilLog2 function definition in ospi_v0.c uses the following for loop:

      uint32_t i, k;
      
      for(i = 31; i >= 0; i--)
      {
          k = (num >> i) & 0x01;
          if(k == 1)
          {
              break;
          }
      }
      

      This for loop is an infinite loop. This looks like an unintentional mistake. However, if it is intentional, using 

      for(;;)

       seems a better choice to show the intention.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: