Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
9001ad2d
Commit
9001ad2d
authored
Oct 27, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct calloc_or_fail() signature
parent
9a57514b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
26 additions
and
27 deletions
+26
-27
common/utils/ocp_itti/intertask_interface.h
common/utils/ocp_itti/intertask_interface.h
+0
-2
common/utils/utils.h
common/utils/utils.h
+7
-6
openair3/NAS/UE/EMM/IdleMode.c
openair3/NAS/UE/EMM/IdleMode.c
+1
-1
openair3/NAS/UE/EMM/emm_main.c
openair3/NAS/UE/EMM/emm_main.c
+4
-4
openair3/NAS/UE/ESM/esm_ebr.c
openair3/NAS/UE/ESM/esm_ebr.c
+1
-1
openair3/NAS/UE/ESM/esm_main.c
openair3/NAS/UE/ESM/esm_main.c
+1
-1
openair3/NAS/UE/ESM/esm_pt.c
openair3/NAS/UE/ESM/esm_pt.c
+1
-1
openair3/NAS/UE/nas_proc.c
openair3/NAS/UE/nas_proc.c
+2
-2
openair3/NAS/UE/nas_ue_task.c
openair3/NAS/UE/nas_ue_task.c
+7
-7
openair3/NAS/UE/nas_user.c
openair3/NAS/UE/nas_user.c
+2
-2
No files found.
common/utils/ocp_itti/intertask_interface.h
View file @
9001ad2d
...
...
@@ -568,8 +568,6 @@ void itti_set_task_real_time(task_id_t task_id);
void
itti_send_terminate_message
(
task_id_t
task_id
);
void
*
itti_malloc
(
task_id_t
origin_task_id
,
task_id_t
destination_task_id
,
ssize_t
size
);
void
*
calloc_or_fail
(
size_t
size
);
void
*
malloc_or_fail
(
size_t
size
);
int
memory_read
(
const
char
*
datafile
,
void
*
data
,
size_t
size
);
int
itti_free
(
task_id_t
task_id
,
void
*
ptr
);
...
...
common/utils/utils.h
View file @
9001ad2d
...
...
@@ -56,23 +56,24 @@ static inline void *malloc16_clear( size_t size ) {
return
ptr
;
}
static
inline
void
*
calloc_or_fail
(
size_t
size
)
{
void
*
ptr
=
calloc
(
1
,
size
);
static
inline
void
*
calloc_or_fail
(
size_t
nmemb
,
size_t
size
)
{
void
*
ptr
=
calloc
(
nmemb
,
size
);
if
(
ptr
==
NULL
)
{
fprintf
(
stderr
,
"
[UE] Failed to calloc %zu bytes"
,
size
);
fprintf
(
stderr
,
"
Failed to calloc() %zu elements of %zu bytes: out of memory"
,
nmemb
,
size
);
exit
(
EXIT_FAILURE
);
}
return
ptr
;
}
static
inline
void
*
malloc_or_fail
(
size_t
size
)
{
static
inline
void
*
malloc_or_fail
(
size_t
size
)
{
void
*
ptr
=
malloc
(
size
);
if
(
ptr
==
NULL
)
{
fprintf
(
stderr
,
"
[UE] Failed to malloc %zu bytes
"
,
size
);
fprintf
(
stderr
,
"
Failed to malloc() %zu bytes: out of memory
"
,
size
);
exit
(
EXIT_FAILURE
);
}
...
...
openair3/NAS/UE/EMM/IdleMode.c
View file @
9001ad2d
...
...
@@ -107,7 +107,7 @@ static IdleMode_callback_t _emm_indication_notify;
***************************************************************************/
void
IdleMode_initialize
(
nas_user_t
*
user
,
IdleMode_callback_t
cb
)
{
emm_plmn_list_t
*
emm_plmn_list
=
calloc_or_fail
(
sizeof
(
emm_plmn_list_t
));
emm_plmn_list_t
*
emm_plmn_list
=
calloc_or_fail
(
1
,
sizeof
(
emm_plmn_list_t
));
user
->
emm_plmn_list
=
emm_plmn_list
;
/* Initialize the list of available PLMNs */
emm_plmn_list
->
n_plmns
=
0
;
...
...
openair3/NAS/UE/EMM/emm_main.c
View file @
9001ad2d
...
...
@@ -135,7 +135,7 @@ void _emm_detach_initialize(emm_detach_data_t *emm_detach) {
void
emm_main_initialize
(
nas_user_t
*
user
,
emm_indication_callback_t
cb
,
const
char
*
imei
)
{
LOG_FUNC_IN
;
user
->
emm_data
=
calloc_or_fail
(
sizeof
(
emm_data_t
));
user
->
emm_data
=
calloc_or_fail
(
1
,
sizeof
(
emm_data_t
));
/* USIM validity indicator */
user
->
emm_data
->
usim_is_valid
=
false
;
/* The IMEI read from the UE's non-volatile memory */
...
...
@@ -433,19 +433,19 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/*
* Initialize EMM timers
*/
user
->
emm_data
->
emm_timers
=
calloc_or_fail
(
sizeof
(
emm_timers_t
));
user
->
emm_data
->
emm_timers
=
calloc_or_fail
(
1
,
sizeof
(
emm_timers_t
));
_emm_timers_initialize
(
user
->
emm_data
->
emm_timers
);
/*
* Initialize Internal data used for detach procedure
*/
user
->
emm_data
->
emm_detach_data
=
calloc_or_fail
(
sizeof
(
emm_detach_data_t
));
user
->
emm_data
->
emm_detach_data
=
calloc_or_fail
(
1
,
sizeof
(
emm_detach_data_t
));
_emm_detach_initialize
(
user
->
emm_data
->
emm_detach_data
);
/*
* Initialize Internal data used for attach procedure
*/
user
->
emm_data
->
emm_attach_data
=
calloc_or_fail
(
sizeof
(
emm_attach_data_t
));
user
->
emm_data
->
emm_attach_data
=
calloc_or_fail
(
1
,
sizeof
(
emm_attach_data_t
));
_emm_attach_initialize
(
user
->
emm_data
->
emm_attach_data
);
/*
...
...
openair3/NAS/UE/ESM/esm_ebr.c
View file @
9001ad2d
...
...
@@ -119,7 +119,7 @@ esm_ebr_data_t *esm_ebr_initialize(void)
LOG_FUNC_IN
;
int
i
;
esm_ebr_data_t
*
esm_ebr_data
=
calloc_or_fail
(
sizeof
(
esm_ebr_data_t
));
esm_ebr_data_t
*
esm_ebr_data
=
calloc_or_fail
(
1
,
sizeof
(
esm_ebr_data_t
));
esm_ebr_data
->
index
=
0
;
...
...
openair3/NAS/UE/ESM/esm_main.c
View file @
9001ad2d
...
...
@@ -79,7 +79,7 @@ void esm_main_initialize(nas_user_t *user, esm_indication_callback_t cb)
int
i
;
esm_data_t
*
esm_data
=
calloc_or_fail
(
sizeof
(
esm_data_t
));
esm_data_t
*
esm_data
=
calloc_or_fail
(
1
,
sizeof
(
esm_data_t
));
user
->
esm_data
=
esm_data
;
default_eps_bearer_context_data_t
*
default_eps_bearer_context
=
calloc
(
1
,
sizeof
(
default_eps_bearer_context_data_t
));
...
...
openair3/NAS/UE/ESM/esm_pt.c
View file @
9001ad2d
...
...
@@ -88,7 +88,7 @@ static int _esm_pt_get_available_entry(esm_pt_data_t *esm_pt_data);
esm_pt_data_t
*
esm_pt_initialize
(
void
)
{
LOG_FUNC_IN
;
esm_pt_data_t
*
esm_pt_data
=
calloc_or_fail
(
sizeof
(
esm_pt_data_t
));
esm_pt_data_t
*
esm_pt_data
=
calloc_or_fail
(
1
,
sizeof
(
esm_pt_data_t
));
int
i
;
esm_pt_data
->
index
=
0
;
...
...
openair3/NAS/UE/nas_proc.c
View file @
9001ad2d
...
...
@@ -97,8 +97,8 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
user
->
proc
.
rsrq
=
NAS_PROC_RSRQ_UNKNOWN
;
user
->
proc
.
rsrp
=
NAS_PROC_RSRP_UNKNOWN
;
user
->
authentication_data
=
calloc_or_fail
(
sizeof
(
authentication_data_t
));
user
->
security_data
=
calloc_or_fail
(
sizeof
(
security_data_t
));
user
->
authentication_data
=
calloc_or_fail
(
1
,
sizeof
(
authentication_data_t
));
user
->
security_data
=
calloc_or_fail
(
1
,
sizeof
(
security_data_t
));
/* Initialize the EMM procedure manager */
emm_main_initialize
(
user
,
emm_cb
,
imei
);
...
...
openair3/NAS/UE/nas_ue_task.c
View file @
9001ad2d
...
...
@@ -67,7 +67,7 @@ static bool nas_ue_process_events(nas_user_container_t *users, struct epoll_even
// Initialize user api id and port number
void
nas_user_api_id_initialize
(
nas_user_t
*
user
)
{
user_api_id_t
*
user_api_id
=
calloc_or_fail
(
sizeof
(
user_api_id_t
));
user_api_id_t
*
user_api_id
=
calloc_or_fail
(
1
,
sizeof
(
user_api_id_t
));
user
->
user_api_id
=
user_api_id
;
char
*
port
=
make_port_str_from_ueid
(
NAS_PARSER_DEFAULT_USER_PORT_NUMBER
,
user
->
ueid
);
if
(
port
==
NULL
)
{
...
...
@@ -130,9 +130,9 @@ void *nas_ue_task(void *args_p)
/* Initialize user interface (to exchange AT commands with user process) */
nas_user_api_id_initialize
(
user
);
/* allocate needed structures */
user
->
user_at_commands
=
calloc_or_fail
(
sizeof
(
user_at_commands_t
));
user
->
at_response
=
calloc_or_fail
(
sizeof
(
at_response_t
));
user
->
lowerlayer_data
=
calloc_or_fail
(
sizeof
(
lowerlayer_data_t
));
user
->
user_at_commands
=
calloc_or_fail
(
1
,
sizeof
(
user_at_commands_t
));
user
->
at_response
=
calloc_or_fail
(
1
,
sizeof
(
at_response_t
));
user
->
lowerlayer_data
=
calloc_or_fail
(
1
,
sizeof
(
lowerlayer_data_t
));
/* Initialize NAS user */
nas_user_initialize
(
user
,
&
user_api_emm_callback
,
&
user_api_esm_callback
,
FIRMWARE_VERSION
);
}
...
...
@@ -170,9 +170,9 @@ void *nas_ue_task(void *args_p)
/* Initialize user interface (to exchange AT commands with user process) */
nas_user_api_id_initialize
(
user
);
/* allocate needed structures */
user
->
user_at_commands
=
calloc_or_fail
(
sizeof
(
user_at_commands_t
));
user
->
at_response
=
calloc_or_fail
(
sizeof
(
at_response_t
));
user
->
lowerlayer_data
=
calloc_or_fail
(
sizeof
(
lowerlayer_data_t
));
user
->
user_at_commands
=
calloc_or_fail
(
1
,
sizeof
(
user_at_commands_t
));
user
->
at_response
=
calloc_or_fail
(
1
,
sizeof
(
at_response_t
));
user
->
lowerlayer_data
=
calloc_or_fail
(
1
,
sizeof
(
lowerlayer_data_t
));
/* Initialize NAS user */
nas_user_initialize
(
user
,
&
user_api_emm_callback
,
&
user_api_esm_callback
,
FIRMWARE_VERSION
);
user
->
ueid
=
0
;
...
...
openair3/NAS/UE/nas_user.c
View file @
9001ad2d
...
...
@@ -154,7 +154,7 @@ void nas_user_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
{
LOG_FUNC_IN
;
user
->
nas_user_nvdata
=
calloc_or_fail
(
sizeof
(
user_nvdata_t
));
user
->
nas_user_nvdata
=
calloc_or_fail
(
1
,
sizeof
(
user_nvdata_t
));
/* Get UE data stored in the non-volatile memory device */
int
rc
=
memory_read
(
user
->
user_nvdata_store
,
user
->
nas_user_nvdata
,
sizeof
(
user_nvdata_t
));
...
...
@@ -163,7 +163,7 @@ void nas_user_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
abort
();
}
user
->
nas_user_context
=
calloc_or_fail
(
sizeof
(
nas_user_context_t
));
user
->
nas_user_context
=
calloc_or_fail
(
1
,
sizeof
(
nas_user_context_t
));
_nas_user_context_initialize
(
user
->
nas_user_context
,
version
);
/* Initialize the internal NAS processing data */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment