FreeCalypso > hg > fc-magnetite
view cdg211/cdginc/p_sn.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 | 56abf6cf8a0b |
| children |
line wrap: on
line source
/* +--------------------------------------------------------------------------+ | PROJECT : PROTOCOL STACK | | FILE : p_sn.h | | SOURCE : "__out__\g23m_dfile\prim\sn.pdf" | | LastModified : "2001-10-08" | | IdAndVersion : "8441.110.99.006" | | SrcFileTime : "Thu Feb 17 14:43:54 2005" | | Generated by CCDGEN_2.5.5 on Fri Jun 08 13:59:16 2007 | | !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | +--------------------------------------------------------------------------+ */ /* PRAGMAS * PREFIX : NONE * COMPATIBILITY_DEFINES : NO (require PREFIX) * ALWAYS_ENUM_IN_VAL_FILE: NO * ENABLE_GROUP: NO * CAPITALIZE_TYPENAME: NO */ #ifndef P_SN_H #define P_SN_H #define CDG_ENTER__P_SN_H #define CDG_ENTER__FILENAME _P_SN_H #define CDG_ENTER__P_SN_H__FILE_TYPE CDGINC #define CDG_ENTER__P_SN_H__LAST_MODIFIED _2001_10_08 #define CDG_ENTER__P_SN_H__ID_AND_VERSION _8441_110_99_006 #define CDG_ENTER__P_SN_H__SRC_FILE_TIME _Thu_Feb_17_14_43_54_2005 #include "CDG_ENTER.h" #undef CDG_ENTER__P_SN_H #undef CDG_ENTER__FILENAME #include "p_sn.val" #ifndef __T_desc_list2__ #define __T_desc_list2__ /* * list of generic data descriptors * CCDGEN:WriteStruct_Count==2150 */ typedef struct { U16 list_len; /*< 0: 2> length in octets of whole data */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ U32 first; /*< 4: 4> pointer to generic data descriptors */ } T_desc_list2; #endif #ifndef __T_reserved_data_ind1__ #define __T_reserved_data_ind1__ /* * to the segment to be confirmed * CCDGEN:WriteStruct_Count==2152 */ typedef struct { U8 ref_nsapi; /*< 0: 1> ref_nsapi */ U8 _align0; /*< 1: 1> alignment */ U16 ref_npdu_num; /*< 2: 2> ref_npdu_num */ U8 ref_seg_num; /*< 4: 1> ref_seg_num */ U8 _align1; /*< 5: 1> alignment */ U8 _align2; /*< 6: 1> alignment */ U8 _align3; /*< 7: 1> alignment */ } T_reserved_data_ind1; #endif /* * to the segment to be confirmed * CCDGEN:WriteStruct_Count==2153 */ #ifndef __T_reserved_unitdata_ind1__ #define __T_reserved_unitdata_ind1__ typedef T_reserved_data_ind1 T_reserved_unitdata_ind1; #endif /* * to the segment to be confirmed * CCDGEN:WriteStruct_Count==2154 */ #ifndef __T_reserved_data_req2__ #define __T_reserved_data_req2__ typedef T_reserved_data_ind1 T_reserved_data_req2; #endif /* * to the segment to be confirmed * CCDGEN:WriteStruct_Count==2155 */ #ifndef __T_reserved_unitdata_req2__ #define __T_reserved_unitdata_req2__ typedef T_reserved_data_ind1 T_reserved_unitdata_req2; #endif /* * End of substructure section, begin of primitive definition section */ #ifndef __T_SN_MODIFICATION_IND__ #define __T_SN_MODIFICATION_IND__ /* * * CCDGEN:WriteStruct_Count==2156 */ typedef struct { U8 ppp_hc; /*< 0: 1> header compression of PPP connection */ U8 msid; /*< 1: 1> max slot identifier */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ } T_SN_MODIFICATION_IND; #endif #ifndef __T_SN_COUNT_REQ__ #define __T_SN_COUNT_REQ__ /* * * CCDGEN:WriteStruct_Count==2157 */ typedef struct { U8 nsapi; /*< 0: 1> network layer service access point identifier */ U8 reset; /*< 1: 1> reset flag */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ } T_SN_COUNT_REQ; #endif #ifndef __T_SN_COUNT_CNF__ #define __T_SN_COUNT_CNF__ /* * * CCDGEN:WriteStruct_Count==2158 */ typedef struct { U8 nsapi; /*< 0: 1> network layer service access point identifier */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ U32 octets_uplink; /*< 4: 4> octets uplink */ U32 octets_downlink; /*< 8: 4> octets downlink */ U32 packets_uplink; /*< 12: 4> packets uplink */ U32 packets_downlink; /*< 16: 4> packets downlink */ } T_SN_COUNT_CNF; #endif #ifndef __T_SN_SWITCH_REQ__ #define __T_SN_SWITCH_REQ__ /* * * CCDGEN:WriteStruct_Count==2159 */ typedef struct { U8 nsapi; /*< 0: 1> network layer service access point identifier */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ U32 dti_linkid; /*< 4: 4> DTI link identifier */ U32 dti_neighbor; /*< 8: 4> DTI neighbor entity name */ U8 dti_direction; /*< 12: 1> direction of DTI connection */ U8 _align3; /*< 13: 1> alignment */ U8 _align4; /*< 14: 1> alignment */ U8 _align5; /*< 15: 1> alignment */ } T_SN_SWITCH_REQ; #endif #ifndef __T_SN_SWITCH_CNF__ #define __T_SN_SWITCH_CNF__ /* * * CCDGEN:WriteStruct_Count==2160 */ typedef struct { U8 nsapi; /*< 0: 1> network layer service access point identifier */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_SN_SWITCH_CNF; #endif #include "CDG_LEAVE.h" #endif
