我环顾四周,没有找到任何可以帮助我的东西......我正在构建一个内核并且得到了一些,数组下标高于数组边界,警告构建失败。我正在使用 Linaro 工具链并设置为 -O3,因此任何警告都会使构建失败...感谢所有帮助
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
这里失败的方法......
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 *)&uwIntrSetsDivertedToPad1);
/* Trace through InterruptSets */
while(bIntrSetID < TOTAL_INTERRUPT_SETS)
{
if( (bInterruptId>=bFirstIndexForSet[bIntrSetID])&&(bInterruptId<bFirstIndexForSet[bIntrSetID+1]) )
{
if((uwIntrSetsDivertedToPad1>>bIntrSetID)&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;
}
它在线错误:
if( (bInterruptId>=bFirstIndexForSet[bIntrSetID])&&(bInterruptId < bFirstIndexForSet[bIntrSetID+1]) )