[LU-9513] New static analysis issues in v2_9_57_0-66-gb6d5b5b Created: 16/May/17 Updated: 30/Aug/23 Resolved: 29/May/17 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.10.0 |
| Fix Version/s: | Lustre 2.10.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Dmitry Eremin (Inactive) | Assignee: | Niu Yawei (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | kw | ||
| Issue Links: |
|
||||||||||||
| Severity: | 3 | ||||||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||||||
| Description |
|
Found 1 new static analysis issues in v2_9_57_0-66-gb6d5b5b:
The list of commits since the previous build v2_9_57_0-45-gcdc7b3b:
|
| Comments |
| Comment by Peter Jones [ 16/May/17 ] |
|
Niu Could you pelase assist with this issue? Peter |
| Comment by Niu Yawei (Inactive) [ 17/May/17 ] |
layout = llapi_layout_alloc();
if (layout == NULL)
return -1;
llapi_layout_comp_extent_set(layout, 0, LUSTRE_EOF);
comp = __llapi_layout_cur_comp(layout);
comp->llc_id = id;
comp->llc_flags = flags;
For this particular call to "__llapi_layout_cur_comp(layout)", it's different from other callers (where the 'layout' is passed in from user apps), the 'layout' is constructed internally by the caller itself, so we can guarantee the 'layout' is valid, and the __llapi_layout_cur_comp() won't return a NULL on a valid 'layout'. I'm wondering why the analysis tool warn about this, is this a shortcoming (or defect) of the tool? Or I missed anything in the code? Bobi, could you double check the code to see if I missed anything which may lead to a NULL being returned? Dmitry/Andreas, should we add redundant check to make analysis tool happy or just leave it as-is? I'm not quite sure what policy we used for such kind of issues. |
| Comment by Zhenyu Xu [ 17/May/17 ] |
|
current code can make sure that 1963 returned a non-NULL pointer, while I think we'd add the check, since further code change could possibly introduce NULL pointer. |
| Comment by Dmitry Eremin (Inactive) [ 17/May/17 ] |
|
My position is we should write robust code. Even if now this condition is not possible we should check for it to avoid crash or unxpected behavior in the future when something can be changed. We cannot remember all details of all calling conventions especially without comments. |
| Comment by Gerrit Updater [ 17/May/17 ] |
|
Niu Yawei (yawei.niu@intel.com) uploaded a new patch: https://review.whamcloud.com/27154 |
| Comment by Gerrit Updater [ 29/May/17 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/27154/ |
| Comment by Peter Jones [ 29/May/17 ] |
|
Landed for 2.10 |