x86/net/bpf: return statement missing value
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Triaged
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned |
Bug Description
SRU Justification
=================
Coverity reports:
*** CID 1464330: Uninitialized variables (MISSING_RETURN)
/arch/x86/
1082 int i;
1083 1084 if (!bpf_jit_enable)
1085 return prog;
1086 1087 if (!prog || !prog->len)
>>> CID 1464330: Uninitialized variables (MISSING_RETURN)
>>> Arriving at the end of a function without returning a value.
1088 return;
1089 1090 addrs = kmalloc(prog->len * sizeof(*addrs), GFP_KERNEL);
1091 if (!addrs)
1092 return prog;
1093
This is a result of 3098d8eae421 ("bpf: prepare bpf_int_
It did not, however, change the return statement of the (!prog || !prog->len) check, as in upstream the (!prog || !prog->len) check was dropped in 93a73d442d37 ("bpf, x86/arm64: remove useless checks on prog"):
"""
There is never such a situation, where bpf_int_
called with either prog as NULL or len as 0, so the tests are
unnecessary and confusing as people would just copy them.
"""
However, we haven't picked up 93a73d442d37, so when we cherry-picked d1c55ab5e41f, that branch remained unmodified, hence the static analysis warning.
Impact
======
If the branch is not dead and someone can hit it, an undefined value can be returned, which could cause issues.
Fix
===
For consistency and in case the branch is not actually dead on Xenial, we should do a fixup to 'return prog;'
Regression Potential
=======
Limited to the BPF jit which is off by default.
Limited to a branch that should be dead code anyway.
Limited to an error handling path.
description: | updated |
Changed in linux (Ubuntu): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Xenial): | |
status: | New → Triaged |
Changed in linux (Ubuntu): | |
status: | Confirmed → Triaged |
Changed in linux (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Xenial): | |
status: | Triaged → Fix Committed |
This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification- needed- xenial' to 'verification- done-xenial' . If the problem still exists, change the tag 'verification- needed- xenial' to 'verification- failed- xenial' .
If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.
See https:/ /wiki.ubuntu. com/Testing/ EnableProposed for documentation how to enable and use -proposed. Thank you!