Tool/software: Code Composer Studio
It can be fixed like this
static int8_t NVOCMP_findItem(NVOCMP_nvHandle_t *pNvHandle, uint8_t pg, uint16_t ofs,
NVOCMP_itemHdr_t *pHdr, int8_t flag, NVOCMP_itemInfo_t *pInfo)
{
bool found = FALSE;
uint8_t p;
uint16_t items = 0;
uint16_t nvSearched = 0;
#ifdef NVOCMP_GPRAM
uint32_t vm;
uint8_t *pTBuffer = RAM_BUFFER_ADDRESS;
#else
uint8_t *pTBuffer = (uint8_t *)tBuffer;
#endif
uint32_t cid = NVOCMP_CMPRID(pHdr->sysid,pHdr->itemid,pHdr->subid);
#ifdef NVOCMP_GPRAM
NVOCMP_disableCache(&vm);
#endif
for(p = pg; nvSearched < NVOCMP_NVSIZE; p = NVOCMP_DECPAGE(p), ofs = pNvHandle->pageInfo[p].offset)
{
nvSearched++;
#if (NVOCMP_NVPAGES != NVOCMP_NVONEP)
if(p == pNvHandle->tailPage)
{
continue;
}
#endif
NVOCMP_read(p, 0, (uint8_t *)pTBuffer, FLASH_PAGE_SIZE); // fix here, variable 'pg' change to 'p'.
while(ofs >= (NVOCMP_PGDATAOFS + NVOCMP_ITEMHDRLEN))