title: array subscript is above array bounds [-Warray-bounds]
body: <p>I looked around and didn't find anything that could help me.... I am building a kernel and am getting a few, array subscript is above array bounds, warnings which FAILS the build. I am using Linaro toolchain and set to -O3 so any warning will FAIL the build... Thanks for all the help</p>
  
  <pre><code>    drivers/media/video/msm/rawchip/Yushan_API.c: In function 'Yushan_Check_Pad_For_IntrID':
  drivers/media/video/msm/rawchip/Yushan_API.c:1751:85: warning: array subscript is above array bounds [-Warray-bounds]
  error, forbidden warning: Yushan_API.c:1751
  </code></pre>
  
  <p>Here the method in which it fails...</p>
  
  <pre><code>bool_t  Yushan_Check_Pad_For_IntrID(uint8_t bInterruptId)
  {
  
      uint8_t     bFirstIndexForSet[] = {1, 5, 11, 17, 23, 27, 58, 62, 69, 77, 79, 82, 83};
      uint8_t     bIntrSetID = 0;
      uint16_t    uwIntrSetsDivertedToPad1 = 0;
  
      VERBOSELOG("[CAM] %s: Start\n", __func__);
      /* Read the list of the interrupt sets diverted to Pad1 */
      SPI_Read(YUSHAN_IOR_NVM_SEND_ITR_PAD1 , 2, (uint8_t *)&amp;uwIntrSetsDivertedToPad1);
  
      /* Trace through InterruptSets */
      while(bIntrSetID &lt; TOTAL_INTERRUPT_SETS)
      {
  
          if( (bInterruptId&gt;=bFirstIndexForSet[bIntrSetID])&amp;&amp;(bInterruptId&lt;bFirstIndexForSet[bIntrSetID+1]) )
          {
              if((uwIntrSetsDivertedToPad1&gt;&gt;bIntrSetID)&amp;0x01) {
                  VERBOSELOG("[CAM] %s: End\n", __func__);
                  return INTERRUPT_PAD_1;
              } else {
                  VERBOSELOG("[CAM] %s: End\n", __func__);
                  return INTERRUPT_PAD_0;
              }
          } else
              bIntrSetID++;
  
      }
  
      /* Just to remove warning */
      VERBOSELOG("[CAM] %s: End\n", __func__);
      return INTERRUPT_PAD_0;
  
  }
  </code></pre>
  
  <p>It errors on line:</p>
  
  <pre><code>if( (bInterruptId&gt;=bFirstIndexForSet[bIntrSetID])&amp;&amp;(bInterruptId &lt; bFirstIndexForSet[bIntrSetID+1]) )
  </code></pre>