[LU-5864] New static analysis issues in lfs Created: 05/Nov/14  Updated: 30/Aug/23  Resolved: 11/Dec/14

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

Type: Bug Priority: Minor
Reporter: Dmitry Eremin (Inactive) Assignee: Dmitry Eremin (Inactive)
Resolution: Not a Bug Votes: 0
Labels: kw

Issue Links:
Related
is related to LU-4629 Issues found by static analysis tools Resolved
Severity: 3
Rank (Obsolete): 16412

 Description   

In commit 979203503af2f77d51bcf27375a1a09f5f28a4a3 (LU-4665 utils: lfs setstripe to specify OSTs) was introduced suspicious dereference of pointer 'ptr' before NULL check at line 704.



 Comments   
Comment by Dmitry Eremin (Inactive) [ 11/Dec/14 ]
ptr = strchrnul(arg, ',');
end_of_loop = *ptr == '\0';
*ptr = '\0';

According manual:

The strchrnul() function is like strchr() except that if c is not found in s, then it returns a pointer to the null byte at the end of s, rather than NULL.

Therefore ptr can not by NULL here. It's false positive of static analysis tool.

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