[LU-3023] Fix fuzzy logic in get_root_path() Created: 25/Mar/13  Updated: 26/Mar/14  Resolved: 03/May/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.4.0
Fix Version/s: Lustre 2.4.0

Type: Task Priority: Minor
Reporter: Sebastien Buisson (Inactive) Assignee: James Nunez (Inactive)
Resolution: Fixed Votes: 0
Labels: coverity, patch

Rank (Obsolete): 7360

 Description   

While analyzing the Lustre code with Coverity, we found an incorrect logic in the get_root_path() function.

Here is Andreas' comment from http://review.whamcloud.com/#patch,sidebyside,5271,5,lustre/utils/liblustreapi.c:
"In that case, why have the "if (!ptr" check above? Probably Coverity is confused that ptr is checked against NULL above, but can fall through in the "len != 0" case and dereference the NULL ptr.

I suspect the reader and coverity would be happier if there was "LASSERT(ptr != NULL)" after strrchr(), though definitely your comment clearly explains why this LASSERT() would be true, and it should be kept.

Code style says this should have been "if (ptr == NULL && len == 0)". This makes me wonder about the above check as well. Why should the scanning be aborted if (len == 0) (i.e. no other mountpoint is found)? Since IMHO it should just continue on, and ptr is never NULL, I think the above check and -EINVAL could just be removed, perhaps in a separate patch."

I will propose a patch to address remark from Andreas.



 Comments   
Comment by Sebastien Buisson (Inactive) [ 25/Mar/13 ]

The patch is at:
http://review.whamcloud.com/5832

Thanks,
Sebastien.

Comment by Peter Jones [ 25/Mar/13 ]

James

Could you please take care of this one?

Thanks

Peter

Comment by James Nunez (Inactive) [ 03/May/13 ]

Landed for 2.4

Generated at Sat Feb 10 01:30:18 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.