FreeCalypso > hg > fc-magnetite
view cdg3/cdginc-conservative/p_8010_134_mmpm_sap.h @ 516:1ed9de6c90bd
src/g23m-gsm/sms/sms_for.c: bogus malloc removed
The new error handling code that was not present in TCS211 blob version
contains a malloc call that is bogus for 3 reasons:
1) The memory allocation in question is not needed in the first place;
2) libc malloc is used instead of one of the firmware's proper ways;
3) The memory allocation is made inside a function and then never freed,
i.e., a memory leak.
This bug was caught in gcc-built FreeCalypso fw projects (Citrine
and Selenite) because our gcc environment does not allow any use of
libc malloc (any reference to malloc produces a link failure),
but this code from TCS3.2 is wrong even for Magnetite: if this code
path is executed repeatedly over a long time, the many small allocations
made by this malloc call without a subsequent free will eventually
exhaust the malloc heap provided by the TMS470 environment, malloc will
start returning NULL, and the bogus code will treat it as an error.
Because the memory allocation in question is not needed at all,
the fix entails simply removing it.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 22 Jul 2018 06:04:49 +0000 |
parents | c15047b3d00d |
children |
line wrap: on
line source
/* +--------------------------------------------------------------------------+ | PROJECT : PROTOCOL STACK | | FILE : p_8010_134_mmpm_sap.h | | SOURCE : "sap\8010_134_mmpm_sap.pdf" | | LastModified : "2003-07-29" | | IdAndVersion : "8010.134.02.007" | | SrcFileTime : "Thu Nov 29 09:27:04 2007" | | Generated by CCDGEN_2.5.5A on Thu Sep 25 09:52:55 2014 | | !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | +--------------------------------------------------------------------------+ */ /* PRAGMAS * PREFIX : MMPM * COMPATIBILITY_DEFINES : NO * ALWAYS_ENUM_IN_VAL_FILE: YES * ENABLE_GROUP: NO * CAPITALIZE_TYPENAME: NO */ #ifndef P_8010_134_MMPM_SAP_H #define P_8010_134_MMPM_SAP_H #define CDG_ENTER__P_8010_134_MMPM_SAP_H #define CDG_ENTER__FILENAME _P_8010_134_MMPM_SAP_H #define CDG_ENTER__P_8010_134_MMPM_SAP_H__FILE_TYPE CDGINC #define CDG_ENTER__P_8010_134_MMPM_SAP_H__LAST_MODIFIED _2003_07_29 #define CDG_ENTER__P_8010_134_MMPM_SAP_H__ID_AND_VERSION _8010_134_02_007 #define CDG_ENTER__P_8010_134_MMPM_SAP_H__SRC_FILE_TIME _Thu_Nov_29_09_27_04_2007 #include "CDG_ENTER.h" #undef CDG_ENTER__P_8010_134_MMPM_SAP_H #undef CDG_ENTER__FILENAME #include "p_8010_134_mmpm_sap.val" #include "p_8010_137_nas_include.h" #include "p_8010_152_ps_include.h" #include "p_8010_153_cause_include.h" /* * typedef between var and valtab enums */ #ifndef __T_MMPM_establish_cause__ #define __T_MMPM_establish_cause__ typedef T_MMPM_VAL_establish_cause T_MMPM_establish_cause; #endif #ifndef __T_MMPM_reg_state__ #define __T_MMPM_reg_state__ typedef T_MMPM_VAL_reg_state T_MMPM_reg_state; #endif #ifndef __T_MMPM_npdu_list__ #define __T_MMPM_npdu_list__ /* * list of received N-PDU numbers * CCDGEN:WriteStruct_Count==1247 */ typedef struct { U8 nsapi; /*< 0: 1> T_NAS_nsapi, network layer service access point identifier */ U8 receive_n_pdu_number_val; /*< 1: 1> Receive N-PDU Number value */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ } T_MMPM_npdu_list; #endif /* * End of substructure section, begin of primitive definition section */ #ifndef __T_MMPM_ATTACH_IND__ #define __T_MMPM_ATTACH_IND__ /* * * CCDGEN:WriteStruct_Count==1248 */ typedef struct { U8 rat; /*< 0: 1> T_PS_rat, Radio access technology */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_ATTACH_IND; #endif #ifndef __T_MMPM_DETACH_IND__ #define __T_MMPM_DETACH_IND__ /* * * CCDGEN:WriteStruct_Count==1249 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_DETACH_IND; #endif #ifndef __T_MMPM_PDP_CONTEXT_STATUS_REQ__ #define __T_MMPM_PDP_CONTEXT_STATUS_REQ__ /* * * CCDGEN:WriteStruct_Count==1250 */ typedef struct { U16 nsapi_set; /*< 0: 2> PDP Context Status */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ } T_MMPM_PDP_CONTEXT_STATUS_REQ; #endif #ifndef __T_MMPM_RAT_CHANGE_COMPLETED_IND__ #define __T_MMPM_RAT_CHANGE_COMPLETED_IND__ /* * * CCDGEN:WriteStruct_Count==1251 */ typedef struct { U8 rat; /*< 0: 1> T_PS_rat, Radio access technology */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_RAT_CHANGE_COMPLETED_IND; #endif #ifndef __T_MMPM_RAT_CHANGE_IND__ #define __T_MMPM_RAT_CHANGE_IND__ /* * * CCDGEN:WriteStruct_Count==1252 */ typedef struct { U8 rat; /*< 0: 1> T_PS_rat, Radio access technology */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_RAT_CHANGE_IND; #endif #ifndef __T_MMPM_REESTABLISH_REQ__ #define __T_MMPM_REESTABLISH_REQ__ /* * * CCDGEN:WriteStruct_Count==1253 */ typedef struct { U8 establish_cause; /*< 0: 1> T_MMPM_establish_cause, Establish Cause */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_REESTABLISH_REQ; #endif #ifndef __T_MMPM_REESTABLISH_CNF__ #define __T_MMPM_REESTABLISH_CNF__ /* * * CCDGEN:WriteStruct_Count==1254 */ typedef struct { U8 dummy; /*< 0: 1> no parameters */ } T_MMPM_REESTABLISH_CNF; #endif #ifndef __T_MMPM_REESTABLISH_REJ__ #define __T_MMPM_REESTABLISH_REJ__ /* * * CCDGEN:WriteStruct_Count==1255 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_REESTABLISH_REJ; #endif #ifndef __T_MMPM_REG_STATE_REQ__ #define __T_MMPM_REG_STATE_REQ__ /* * * CCDGEN:WriteStruct_Count==1256 */ typedef struct { U8 dummy; /*< 0: 1> no parameters */ } T_MMPM_REG_STATE_REQ; #endif #ifndef __T_MMPM_REG_STATE_CNF__ #define __T_MMPM_REG_STATE_CNF__ /* * * CCDGEN:WriteStruct_Count==1257 */ typedef struct { U8 reg_state; /*< 0: 1> T_MMPM_reg_state, Registration State */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_REG_STATE_CNF; #endif #ifndef __T_MMPM_ERROR_IND__ #define __T_MMPM_ERROR_IND__ /* * * CCDGEN:WriteStruct_Count==1258 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_ERROR_IND; #endif #ifndef __T_MMPM_RESUME_IND__ #define __T_MMPM_RESUME_IND__ /* * * CCDGEN:WriteStruct_Count==1259 */ typedef struct { U8 dummy; /*< 0: 1> no parameters */ } T_MMPM_RESUME_IND; #endif #ifndef __T_MMPM_SEQUENCE_IND__ #define __T_MMPM_SEQUENCE_IND__ /* * * CCDGEN:WriteStruct_Count==1260 */ typedef struct { U8 _align0; /*< 0: 1> alignment */ U8 _align1; /*< 1: 1> alignment */ U8 _align2; /*< 2: 1> alignment */ U8 c_npdu_list; /*< 3: 1> counter */ T_MMPM_npdu_list npdu_list[MMPM_MAX_N_PDU_NUMBER_LIST]; /*< 4: 64> list of received N-PDU numbers */ } T_MMPM_SEQUENCE_IND; #endif #ifndef __T_MMPM_SEQUENCE_RES__ #define __T_MMPM_SEQUENCE_RES__ /* * * CCDGEN:WriteStruct_Count==1261 */ typedef struct { U8 _align0; /*< 0: 1> alignment */ U8 _align1; /*< 1: 1> alignment */ U8 _align2; /*< 2: 1> alignment */ U8 c_npdu_list; /*< 3: 1> counter */ T_MMPM_npdu_list npdu_list[MMPM_MAX_N_PDU_NUMBER_LIST]; /*< 4: 64> list of received N-PDU numbers */ } T_MMPM_SEQUENCE_RES; #endif #ifndef __T_MMPM_SUSPEND_IND__ #define __T_MMPM_SUSPEND_IND__ /* * * CCDGEN:WriteStruct_Count==1262 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_SUSPEND_IND; #endif #ifndef __T_MMPM_UNITDATA_IND__ #define __T_MMPM_UNITDATA_IND__ /* * * CCDGEN:WriteStruct_Count==1263 */ typedef struct { T_sdu sdu; /*< 0: 0> Container for a message */ } T_MMPM_UNITDATA_IND; #endif #ifndef __T_MMPM_UNITDATA_REQ__ #define __T_MMPM_UNITDATA_REQ__ /* * * CCDGEN:WriteStruct_Count==1264 */ typedef struct { U8 org_entity; /*< 0: 1> T_NAS_org_entity, Originator of a request to MM */ U8 v_establish_cause; /*< 1: 1> valid-flag */ U8 establish_cause; /*< 2: 1> T_MMPM_establish_cause, Establish Cause */ U8 v_nsapi_set; /*< 3: 1> valid-flag */ U16 nsapi_set; /*< 4: 2> PDP Context Status */ U8 _align0; /*< 6: 1> alignment */ U8 _align1; /*< 7: 1> alignment */ T_sdu sdu; /*< 8: 0> Container for a message */ } T_MMPM_UNITDATA_REQ; #endif #include "CDG_LEAVE.h" #endif