FreeCalypso > hg > fc-magnetite
view cdg-hybrid/cdginc/m_rr_short_pd.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 | e7a67accfad9 |
children |
line wrap: on
line source
/* +--------------------------------------------------------------------------+ | PROJECT : PROTOCOL STACK | | FILE : m_rr_short_pd.h | | SOURCE : "msg\rr_short_pd.mdf" | | LastModified : "2003-11-06" | | IdAndVersion : "8010.602.03.001" | | SrcFileTime : "Wed Nov 28 10:21:00 2007" | | Generated by CCDGEN_2.5.5A on Fri Oct 14 21:41:52 2016 | | !!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 * CCDNAME: RR_SHORT */ #ifndef M_RR_SHORT_PD_H #define M_RR_SHORT_PD_H #define CDG_ENTER__M_RR_SHORT_PD_H #define CDG_ENTER__FILENAME _M_RR_SHORT_PD_H #define CDG_ENTER__M_RR_SHORT_PD_H__FILE_TYPE CDGINC #define CDG_ENTER__M_RR_SHORT_PD_H__LAST_MODIFIED _2003_11_06 #define CDG_ENTER__M_RR_SHORT_PD_H__ID_AND_VERSION _8010_602_03_001 #define CDG_ENTER__M_RR_SHORT_PD_H__SRC_FILE_TIME _Wed_Nov_28_10_21_00_2007 #include "CDG_ENTER.h" #undef CDG_ENTER__M_RR_SHORT_PD_H #undef CDG_ENTER__FILENAME #include "m_rr_short_pd.val" #include "m_rr_com.h" #ifndef __T_emp__ #define __T_emp__ /* * EM MEASUREMENT Parameters Description * CCDGEN:WriteStruct_Count==287 */ typedef struct { U8 v_mr; /*< 0: 1> valid-flag */ U8 mr; /*< 1: 1> Multiband Reporting */ U8 v_serv_band_rep; /*< 2: 1> valid-flag */ U8 serv_band_rep; /*< 3: 1> Serving band reporting */ U8 scale_ord; /*< 4: 1> Scale ord */ // STRUCT-FF: REL99 AND ( TI_PS_FF_EMR OR TI_PS_FF_RTD ) // U8 v_report_900; /*< 0: 0> valid-flag */ // // T_report_900 report_900; /*< 0: 0> Reporting 900 (type defined in "m_rr_com.h") */ // STRUCT-FF: REL99 AND ( TI_PS_FF_EMR OR TI_PS_FF_RTD ) // U8 v_report_1800; /*< 0: 0> valid-flag */ // // T_report_1800 report_1800; /*< 0: 0> Reporting 1800 (type defined in "m_rr_com.h") */ // STRUCT-FF: REL99 AND ( TI_PS_FF_EMR OR TI_PS_FF_RTD ) // U8 v_report_400; /*< 0: 0> valid-flag */ // // T_report_400 report_400; /*< 0: 0> Reporting 400 (type defined in "m_rr_com.h") */ // STRUCT-FF: REL99 AND ( TI_PS_FF_EMR OR TI_PS_FF_RTD ) // U8 v_report_1900; /*< 0: 0> valid-flag */ // // T_report_1900 report_1900; /*< 0: 0> Reporting 1900 (type defined in "m_rr_com.h") */ // STRUCT-FF: REL99 AND ( TI_PS_FF_EMR OR TI_PS_FF_RTD ) // U8 v_report_850; /*< 0: 0> valid-flag */ // // T_report_850 report_850; /*< 0: 0> Reporting 850 (type defined in "m_rr_com.h") */ U8 _align0; /*< 5: 1> alignment */ U8 _align1; /*< 6: 1> alignment */ U8 _align2; /*< 7: 1> alignment */ } T_emp; #endif #ifndef __T_i_bsic_i__ #define __T_i_bsic_i__ /* * Invalid BSIC Information * CCDGEN:WriteStruct_Count==288 */ typedef struct { U8 ba_start_bsic; /*< 0: 1> BA Index Start BSIC */ U8 bsic; /*< 1: 1> BSIC */ U8 rxlev; /*< 2: 1> RX Level */ U8 _align0; /*< 3: 1> alignment */ } T_i_bsic_i; #endif #ifndef __T_mi_ext__ #define __T_mi_ext__ /* * MI 2G Extension * CCDGEN:WriteStruct_Count==289 */ typedef struct { U8 e_len; /*< 0: 1> Extension Length */ U8 c_extens; /*< 1: 1> counter */ U8 extens[MAX_2GEXT]; /*< 2:132> Extension */ U8 _align0; /*<134: 1> alignment */ U8 _align1; /*<135: 1> alignment */ } T_mi_ext; #endif #ifndef __T_scdata__ #define __T_scdata__ /* * Serving Cell Data * CCDGEN:WriteStruct_Count==290 */ typedef struct { U8 dtx_used; /*< 0: 1> DTX USED */ U8 rxlev; /*< 1: 1> RX Level */ U8 rxqual_full; /*< 2: 1> RX Quality Full Serving Cell */ U8 mean_bep; /*< 3: 1> Mean BEP */ U8 cv_bep; /*< 4: 1> Coefficient of Variation of BEP */ U8 nr_rcvd_bl; /*< 5: 1> Number Of Received Blocks */ U8 _align0; /*< 6: 1> alignment */ U8 _align1; /*< 7: 1> alignment */ } T_scdata; #endif #ifndef __T_rep_q_arr__ #define __T_rep_q_arr__ /* * Structured Element * CCDGEN:WriteStruct_Count==291 */ typedef struct { U8 v_rep_q; /*< 0: 1> valid-flag */ U8 rep_q; /*< 1: 1> Reporting Quantity */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ } T_rep_q_arr; #endif #ifndef __T_em_rep__ #define __T_em_rep__ /* * EM Bitmap Type Reporting * CCDGEN:WriteStruct_Count==292 */ typedef struct { U8 _align0; /*< 0: 1> alignment */ U8 _align1; /*< 1: 1> alignment */ U8 _align2; /*< 2: 1> alignment */ U8 c_rep_q_arr; /*< 3: 1> counter */ T_rep_q_arr rep_q_arr[MAX_NNC]; /*< 4:384> Structured Element */ } T_em_rep; #endif /* * End of substructure section, begin of message definition section */ #ifndef __T_U_EMR__ #define __T_U_EMR__ /* * * CCDGEN:WriteStruct_Count==293 */ typedef struct { U8 msg_type; /*< 0: 1> Message Type */ U8 sl2h; /*< 1: 1> Short Layer 2 Header */ U8 ba_ind; /*< 2: 1> BA Sequence Number indication */ U8 ba_ind_3g; /*< 3: 1> 3G BA Sequence Number indication */ U8 bsic_seen; /*< 4: 1> BSIC Seen */ U8 scale; /*< 5: 1> Scale */ U8 _align0; /*< 6: 1> alignment */ U8 v_scdata; /*< 7: 1> valid-flag */ T_scdata scdata; /*< 8: 8> Serving Cell Data */ U8 _align1; /*< 16: 1> alignment */ U8 _align2; /*< 17: 1> alignment */ U8 v_i_bsic_i; /*< 18: 1> valid-flag */ U8 c_i_bsic_i; /*< 19: 1> counter */ T_i_bsic_i i_bsic_i[MAX_BSICI]; /*< 20: 32> Invalid BSIC Information */ U8 _align3; /*< 52: 1> alignment */ U8 _align4; /*< 53: 1> alignment */ U8 _align5; /*< 54: 1> alignment */ U8 v_em_rep; /*< 55: 1> valid-flag */ T_em_rep em_rep; /*< 56:388> EM Bitmap Type Reporting */ } T_U_EMR; #endif #ifndef __T_D_MEAS_INF__ #define __T_D_MEAS_INF__ /* * * CCDGEN:WriteStruct_Count==294 */ typedef struct { U8 msg_type; /*< 0: 1> Message Type */ U8 sl2h; /*< 1: 1> Short Layer 2 Header */ U8 ba_ind; /*< 2: 1> BA Sequence Number indication */ U8 ba_ind_3g; /*< 3: 1> 3G BA Sequence Number indication */ U8 mp_cm; /*< 4: 1> Measurement parameters change mark */ U8 mi_idx; /*< 5: 1> MI Index */ U8 mi_c; /*< 6: 1> MI Counter */ U8 pow_ctrl; /*< 7: 1> Power Control Indicator */ U8 report_type; /*< 8: 1> Report Type */ U8 rep_rate; /*< 9: 1> Reporting Rate */ U8 inv_bsic_rep; /*< 10: 1> Invalid BSIC reporting */ // STRUCT-FF: REL99 AND ( TI_PS_FF_EMR OR TI_PS_FF_RTD ) // U8 v_rtdd; /*< 0: 0> valid-flag */ // // T_rtdd rtdd; /*< 0: 0> GPRS Real Time Difference Description (type defined in "m_rr_com.h") */ // U8 v_gprs_bsic; /*< 0: 0> valid-flag */ // // T_gprs_bsic gprs_bsic; /*< 0: 0> GPRS BSIC Description (type defined in "m_rr_com.h") */ // U8 v_gprs_rep_prio; /*< 0: 0> valid-flag */ // // T_gprs_rep_prio gprs_rep_prio; /*< 0: 0> GPRS REPORT PRIORITY Description (type defined in "m_rr_com.h") */ // U8 v_emp; /*< 11: 1> valid-flag */ // // T_emp emp; /*< 12: 8> EM MEASUREMENT Parameters Description */ // U8 _align0; /*< 20: 1> alignment */ // U8 _align1; /*< 21: 1> alignment */ // U8 _align2; /*< 22: 1> alignment */ // U8 v_mi_ext; /*< 23: 1> valid-flag */ // // T_mi_ext mi_ext; /*< 24:136> MI 2G Extension */ // } T_D_MEAS_INF; // #endif // #include "CDG_LEAVE.h" #endif