|
@@ -7,6 +7,8 @@
|
|
|
#include <stdlib.h>
|
|
|
#include <string.h>
|
|
|
|
|
|
+#include "goahead.h"
|
|
|
+
|
|
|
#include "libipmi_AppDevice.h"
|
|
|
#include "libipmi_session.h"
|
|
|
#include "libipmi_errorcodes.h"
|
|
@@ -646,8 +648,9 @@ uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventR
|
|
|
int j=0;
|
|
|
uint16_t i=0,recindex=0;
|
|
|
uint16_t LastRecID = 0xFFFF,MaxSELEntries=0;
|
|
|
+ uint32_t max_sel_len = MAX_SEL_RECORD*sizeof(SELRec_T) + sizeof(AMIGetSELEntriesRes_T) + 256;//margin
|
|
|
|
|
|
- SELEntries = (uint8_t *)malloc(MAX_SEL_RECORD);
|
|
|
+ SELEntries = (uint8_t *)walloc(max_sel_len);
|
|
|
if(SELEntries == NULL)
|
|
|
{
|
|
|
printf("Memory allocation error in LIBIPMI_HL_AMIGetSELEntires \n");
|
|
@@ -655,7 +658,7 @@ uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventR
|
|
|
return wRet;
|
|
|
}
|
|
|
|
|
|
- memset(SELEntries,0,MAX_SEL_RECORD);
|
|
|
+ memset(SELEntries,0,max_sel_len);
|
|
|
pAMIGetSelEntiresRes = (AMIGetSELEntriesRes_T *)SELEntries;
|
|
|
|
|
|
do
|
|
@@ -665,7 +668,7 @@ uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventR
|
|
|
{
|
|
|
for(i = 0; i < pAMIGetSelEntiresRes->Noofentries; i++)
|
|
|
{
|
|
|
- memcpy((uint8_t *)&pSELEntriesBuffer[i+*nNumSelEntries].EventRecord,&(SELEntries)[sizeof(AMIGetSELEntriesRes_T) + (i * sizeof(SELRec_T))],
|
|
|
+ memcpy((uint8_t *)&pSELEntriesBuffer[i+*nNumSelEntries].EventRecord,&(SELEntries[sizeof(AMIGetSELEntriesRes_T) + (i * sizeof(SELRec_T))]),
|
|
|
sizeof(SELRec_T));
|
|
|
}
|
|
|
|
|
@@ -683,13 +686,13 @@ uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventR
|
|
|
{
|
|
|
*nNumSelEntries += pAMIGetSelEntiresRes->Noofentries;
|
|
|
pAMIGetSelEntriesReq.Noofentretrieved = *nNumSelEntries;
|
|
|
- memset(SELEntries,0,MAX_SEL_RECORD);
|
|
|
+ memset(SELEntries,0,max_sel_len);
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
else if((wRet & 0xFF) == LIBIPMI_E_SEL_CLEARED)
|
|
|
{
|
|
|
- memset(SELEntries,0,MAX_SEL_RECORD);
|
|
|
+ memset(SELEntries,0,max_sel_len);
|
|
|
memset((uint8_t*)&pSELEntriesBuffer[0],0,sizeof(SELEventRecordWithSensorName_T) * *nNumSelEntries);
|
|
|
*nNumSelEntries = pAMIGetSelEntriesReq.Noofentretrieved = 0;
|
|
|
continue;
|
|
@@ -707,8 +710,7 @@ uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventR
|
|
|
}
|
|
|
}while(1);
|
|
|
|
|
|
- free(SELEntries);
|
|
|
-
|
|
|
+ wfree(SELEntries);
|
|
|
|
|
|
if(wRet == LIBIPMI_E_SUCCESS)
|
|
|
{
|
|
@@ -736,7 +738,7 @@ uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventR
|
|
|
}
|
|
|
|
|
|
/*SEL Records added lastely will be displayed first */
|
|
|
- CircSELEntries = (SELEventRecordWithSensorName_T *)malloc (sizeof(SELEventRecordWithSensorName_T) * (*nNumSelEntries));
|
|
|
+ CircSELEntries = (SELEventRecordWithSensorName_T *)walloc (sizeof(SELEventRecordWithSensorName_T) * (*nNumSelEntries));
|
|
|
if(CircSELEntries != NULL)
|
|
|
{
|
|
|
memset(CircSELEntries,0,sizeof(SELEventRecordWithSensorName_T) * (*nNumSelEntries));
|
|
@@ -756,13 +758,11 @@ uint16_t LIBIPMI_HL_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,SELEventR
|
|
|
{
|
|
|
memcpy((uint8_t*)&pSELEntriesBuffer[i],(uint8_t*)&CircSELEntries[*nNumSelEntries - j],sizeof(SELEventRecordWithSensorName_T));
|
|
|
}
|
|
|
-
|
|
|
- free(CircSELEntries);
|
|
|
+ wfree(CircSELEntries);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return (wRet);
|
|
|
}
|