FreeCalypso > hg > fc-magnetite
view cdg211/prim/snsm.pdf @ 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
;******************************************************************************** ;*** File : snsm.pdf ;*** Creation : Fri Jun 08 13:58:36 CST 2007 ;*** XSLT Processor : Apache Software Foundation / http://xml.apache.org/xalan-j / supports XSLT-Ver: 1 ;*** Copyright : (c) Texas Instruments AG, Berlin Germany 2002 ;******************************************************************************** ;*** Document Type : Service Access Point Specification ;*** Document Name : snsm ;*** Document No. : 8441.109.99.005 ;*** Document Date : 2000-06-02 ;*** Document Status: BEING_PROCESSED ;*** Document Author: Harald ;******************************************************************************** PRAGMA SRC_FILE_TIME "Tue Mar 29 15:21:40 2005" PRAGMA LAST_MODIFIED "2000-06-02" PRAGMA ID_AND_VERSION "8441.109.99.005" CONST SNSM_COMP_NEITHER_DIRECT 0b00 ; compress neither direction CONST SNSM_COMP_MS_SGSN_DIRECT 0b01 ; compress MS to SGSN direction only CONST SNSM_COMP_SGSN_MS_DIRECT 0b10 ; compress SGSN to MS direction only CONST SNSM_COMP_BOTH_DIRECT 0b11 ; compress both directions VALTAB VAL_nsapi VAL 0 SNSM_NSAPI_0 "escape mechanism for future extensions" VAL 1 SNSM_NSAPI_1 "Point-To-Multipoint Multicast information" VAL 2 SNSM_NSAPI_2 "reserved for future use" VAL 3 SNSM_NSAPI_3 "reserved for future use" VAL 4 SNSM_NSAPI_4 "reserved for future use" VAL 5 SNSM_NSAPI_5 "dynamically allocated NSAPI value" VAL 6 SNSM_NSAPI_6 "dynamically allocated NSAPI value" VAL 7 SNSM_NSAPI_7 "dynamically allocated NSAPI value" VAL 8 SNSM_NSAPI_8 "dynamically allocated NSAPI value" VAL 9 SNSM_NSAPI_9 "dynamically allocated NSAPI value" VAL 10 SNSM_NSAPI_10 "dynamically allocated NSAPI value" VAL 11 SNSM_NSAPI_11 "dynamically allocated NSAPI value" VAL 12 SNSM_NSAPI_12 "dynamically allocated NSAPI value" VAL 13 SNSM_NSAPI_13 "dynamically allocated NSAPI value" VAL 14 SNSM_NSAPI_14 "dynamically allocated NSAPI value" VAL 15 SNSM_NSAPI_15 "dynamically allocated NSAPI value" VALTAB VAL_peak VAL 0 SNSM_PEAK_SUB "Subscribed peak throughput" VAL 1 SNSM_PEAK_1K "Up to 1 000 octet/s" VAL 2 SNSM_PEAK_2K "Up to 2 000 octet/s" VAL 3 SNSM_PEAK_4K "Up to 4 000 octet/s" VAL 4 SNSM_PEAK_8K "Up to 8 000 octet/s" VAL 5 SNSM_PEAK_16K "Up to 16 000 octet/s" VAL 6 SNSM_PEAK_32K "Up to 32 000 octet/s" VAL 7 SNSM_PEAK_64K "Up to 64 000 octet/s" VAL 8 SNSM_PEAK_128K "Up to 128 000 octet/s" VAL 9 SNSM_PEAK_256K "Up to 256 000 octet/s" VALTAB VAL_relclass VAL 0 SNSM_RELCLASS_SUB "Subscribed reliability class" VAL 1 SNSM_GTP_LLC_RLC_PROT "Acknowledged GTP, LLC, and RLC; Protected data" VAL 2 SNSM_LLC_RLC_PROT "Unacknowledged GTP; Acknowledged LLC and RLC, Protected data" VAL 3 SNSM_RLC_PROT "Unacknowledged GTP and LLC; Acknowledged RLC, Protected data" VAL 4 SNSM_PROT "Unacknowledged GTP, LLC, and RLC, Protected data" VAL 5 SNSM_NO_REL "Unacknowledged GTP, LLC, and RLC, Unprotected data" VALTAB VAL_delay VAL 0 SNSM_DELAY_SUB "Subscribed delay class" VAL 1 SNSM_DELAY_1 "Delay class 1" VAL 2 SNSM_DELAY_2 "Delay class 2" VAL 3 SNSM_DELAY_3 "Delay class 3" VAL 4 SNSM_DELAY_4 "Delay class 4 (best effort)" VALTAB VAL_mean VAL 0 SNSM_MEAN_SUB "Subscribed mean throughput" VAL 1 SNSM_MEAN_100 "100 octet/h" VAL 2 SNSM_MEAN_200 "200 octet/h" VAL 3 SNSM_MEAN_500 "500 octet/h" VAL 4 SNSM_MEAN_1K "1 000 octet/h" VAL 5 SNSM_MEAN_2K "2 000 octet/h" VAL 6 SNSM_MEAN_5K "5 000 octet/h" VAL 7 SNSM_MEAN_10K "10 000 octet/h" VAL 8 SNSM_MEAN_20K "20 000 octet/h" VAL 9 SNSM_MEAN_50K "50 000 octet/h" VAL 10 SNSM_MEAN_100K "100 000 octet/h" VAL 11 SNSM_MEAN_200K "200 000 octet/h" VAL 12 SNSM_MEAN_500K "500 000 octet/h" VAL 13 SNSM_MEAN_1M "1 000 000 octet/h" VAL 14 SNSM_MEAN_2M "2 000 000 octet/h" VAL 15 SNSM_MEAN_5M "5 000 000 octet/h" VAL 16 SNSM_MEAN_10M "10 000 000 octet/h" VAL 17 SNSM_MEAN_20M "20 000 000 octet/h" VAL 18 SNSM_MEAN_50M "50 000 000 octet/h" VAL 31 SNSM_MEAN_BEST "Best effort" VALTAB VAL_preced VAL 0 SNSM_PRECED_SUB "Subscribed precedence" VAL 1 SNSM_PRIO_HIGH "High priority" VAL 2 SNSM_PRIO_NORM "Normal priority" VAL 3 SNSM_PRIO_LOW "Low priority" VALTAB VAL_sapi VAL 1 SNSM_LLC_SAPI_1 "SAP for GMM" VAL 3 SNSM_LLC_SAPI_3 "SAP 1 for SNDCP" VAL 5 SNSM_LLC_SAPI_5 "SAP 2 for SNDCP" VAL 7 SNSM_LLC_SAPI_7 "SAP for SMS" VAL 9 SNSM_LLC_SAPI_9 "SAP 3 for SNDCP" VAL 11 SNSM_LLC_SAPI_11 "SAP 4 for SNDCP" VALTAB VAL_radio_prio VAL 1 SNSM_RADIO_PRIO_1 "radio priority 1 (highest)" VAL 2 SNSM_RADIO_PRIO_2 "radio priority 2" VAL 3 SNSM_RADIO_PRIO_3 "radio priority 3" VAL 4 SNSM_RADIO_PRIO_4 "radio priority 4 (lowest)" VALTAB VAL_rel_ind VAL 0 REL_IND_NO "non-local deactivation" VAL 1 REL_IND_YES "local deactivation" VALTAB VAL_status_cause VAL 0x5100 SNSM_RELCS_INVALID_XID "invalid XID response" VAL 0x5101 SNSM_RELCS_NO_PEER_RES "no peer response" VALTAB VAL_ppp_hc VAL 0 SNSM_VAN_NOT_USED "Van Jacobson is not supported" VAL 1 SNSM_VAN_USED "Van Jacobson is supported" VALTAB VAL_dti_direction VAL 1 SNSM_HOME "mapped to HOME from dti.h" VAL 0 SNSM_NEIGHBOR "mapped to NEIGHBOR from dti.h" VAR nsapi "network layer service access point identifier" B VAL @p_snsm - VAL_nsapi@ VAR delay "delay class" B VAL @p_snsm - VAL_delay@ VAR relclass "reliablility class" B VAL @p_snsm - VAL_relclass@ VAR peak "peak throughput" B VAL @p_snsm - VAL_peak@ VAR preced "precedence class" B VAL @p_snsm - VAL_preced@ VAR mean "main throughput" B VAL @p_snsm - VAL_mean@ VAR nsapi_set "set of network layer service access point identifiers" S VAR sapi "service access point identifier" B VAL @p_snsm - VAL_sapi@ VAR radio_prio "radio priority" B VAL @p_snsm - VAL_radio_prio@ VAR rel_ind "Release indicator" B VAL @p_snsm - VAL_rel_ind@ VAR status_cause "Cause of the error" S VAL @p_snsm - VAL_status_cause@ VAR send_no "send n-pdu number" B VAR rec_no "receive n-pdu number" B VAR ppp_hc "header compression of PPP connection" B VAL @p_snsm - VAL_ppp_hc@ VAR msid "max slot identifier" B VAR hcomp "Header compression used/requested" B VAR dcomp "Data compression used/requested" B VAR dti_linkid "DTI link identifier" L VAR dti_neighbor "DTI neighbor entity name" L VAR dti_direction "direction of DTI connection" B VAL @p_snsm - VAL_dti_direction@ COMP snsm_qos "quality of service" { delay ; delay class relclass ; reliablility class peak ; peak throughput preced ; precedence class mean ; main throughput } ; SNSM_ACTIVATE_IND 0x6700 ; SNSM_ACTIVATE_RES 0x2700 ; SNSM_DEACTIVATE_IND 0x6701 ; SNSM_DEACTIVATE_RES 0x2701 ; SNSM_MODIFY_IND 0x6702 ; SNSM_MODIFY_RES 0x2702 ; SNSM_STATUS_REQ 0x2703 ; SNSM_SEQUENCE_IND 0x6703 ; SNSM_SEQUENCE_RES 0x2704 PRIM SNSM_ACTIVATE_IND 0x6700 { nsapi ; network layer service access point identifier snsm_qos ; quality of service sapi ; service access point identifier radio_prio ; radio priority ppp_hc ; header compression of PPP connection msid ; max slot identifier dcomp ; Data compression used/direction hcomp ; Header compression used/direction dti_linkid ; DTI link-id dti_neighbor ; DTI neighbor entity dti_direction ; DTI direction } PRIM SNSM_ACTIVATE_RES 0x2700 { nsapi ; network layer service access point identifier ppp_hc ; header compression of PPP connection msid ; max slot identifier dcomp ; Data compression used hcomp ; Header compression used } PRIM SNSM_DEACTIVATE_IND 0x6701 { nsapi_set ; set of network layer service access point identifiers rel_ind ; LLC Release indicator } PRIM SNSM_DEACTIVATE_RES 0x2701 { nsapi ; network layer service access point identifier } PRIM SNSM_MODIFY_IND 0x6702 { nsapi ; network layer service access point identifier snsm_qos ; quality of service sapi ; service access point identifier radio_prio ; radio priority send_no ; send n-pdu number rec_no ; receive n-pdu number } PRIM SNSM_MODIFY_RES 0x2702 { nsapi ; network layer service access point identifier } PRIM SNSM_STATUS_REQ 0x2703 { sapi ; service access point identifier status_cause ; cause of the error } PRIM SNSM_SEQUENCE_IND 0x6703 { nsapi ; network layer service access point identifier rec_no ; receive n-pdu number } PRIM SNSM_SEQUENCE_RES 0x2704 { nsapi ; network layer service access point identifier rec_no ; receive n-pdu number }