Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FlightOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Luntzer
FlightOS
Commits
9bb3946b
Commit
9bb3946b
authored
Apr 3, 2017
by
Armin Luntzer
Browse files
Options
Downloads
Patches
Plain Diff
data proc net: check input parameters for NULL arguments
parent
2c678d09
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/data_proc_net.c
+24
-3
24 additions, 3 deletions
lib/data_proc_net.c
with
24 additions
and
3 deletions
lib/data_proc_net.c
+
24
−
3
View file @
9bb3946b
...
...
@@ -268,6 +268,9 @@ struct proc_tracker *pn_get_next_pending_tracker(struct proc_net *pn)
struct
proc_task
*
pn_get_next_pending_task
(
struct
proc_tracker
*
pt
)
{
if
(
!
pt
)
return
NULL
;
return
pt_track_get
(
pt
);
}
...
...
@@ -281,11 +284,24 @@ struct proc_task *pn_get_next_pending_task(struct proc_tracker *pt)
* @þaram ret a tasks op function's return code
*
* @returns 1 if processing of the current tracker may continue or 0 to abort
*
* @note also signals abort for invalid parameters (e.g. NULL);
*/
int
pn_eval_task_status
(
struct
proc_net
*
pn
,
struct
proc_tracker
*
pt
,
struct
proc_task
*
t
,
int
ret
)
{
if
(
!
pn
)
goto
task_abort
;
if
(
!
pt
)
goto
task_abort
;
if
(
!
t
)
goto
task_abort
;
switch
(
ret
)
{
case
PN_TASK_SUCCESS
:
/* move to next stage */
...
...
@@ -430,7 +446,7 @@ int pn_process_inputs(struct proc_net *pn)
pt
=
pn_find_tracker
(
pn
,
op
);
if
(
!
pt
)
{
pr_crit
(
"Error, no such op code, "
"destroying task
\n
"
);
"destroying
input
task
\n
"
);
pt_destroy
(
t
);
...
...
@@ -438,7 +454,6 @@ int pn_process_inputs(struct proc_net *pn)
pt
=
list_entry
(
pn
->
nodes
.
next
,
struct
proc_tracker
,
node
);
t
=
pt_track_get
(
pt
);
continue
;
}
}
...
...
@@ -468,6 +483,9 @@ int pn_process_outputs(struct proc_net *pn)
struct
proc_task
*
t
;
if
(
!
pn
)
return
0
;
while
(
1
)
{
t
=
pt_track_get
(
pn
->
out
);
...
...
@@ -487,7 +505,7 @@ int pn_process_outputs(struct proc_net *pn)
/**
* @brief create an output node of the network
*
* @returns 0 on success, -ENOMEM on alloc error
* @returns 0 on success, -ENOMEM on alloc error
, -EINVAL on NULL pn
*
* @note this destroys the previous output node on success only, otherwise the
* original node is left intact
...
...
@@ -499,6 +517,9 @@ int pn_create_output_node(struct proc_net *pn, op_func_t op)
struct
proc_tracker
*
pt
;
if
(
!
pn
)
return
-
EINVAL
;
pt
=
pt_track_create
(
op
,
PN_OP_NODE_OUT
,
1
);
if
(
!
pt
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment