Bug 1714851
Summary: | issues with 'list.h' elements in clang-scan | ||
---|---|---|---|
Product: | [Community] GlusterFS | Reporter: | Amar Tumballi <atumball> |
Component: | core | Assignee: | bugs <bugs> |
Status: | CLOSED UPSTREAM | QA Contact: | |
Severity: | low | Docs Contact: | |
Priority: | low | ||
Version: | mainline | CC: | bugs, jahernan, pasik |
Target Milestone: | --- | Keywords: | Tracking |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-03-12 12:54:47 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Amar Tumballi
2019-05-29 04:03:01 UTC
I'm not sure we really have an issue in list_for_each_entry_safe(). Even if the list is empty and list_first_entry() is used (which is true that it returns a bad pointer when list is empty), what we get is a pointer to an invalid structure. That's true. However, the macro only dereferences the 'list' field, which is guaranteed to be valid, even if the list is empty, and in this case it will exit the loop, so no unsafe pointers will be passed to the body of the loop. Additionally, clang-scan complains about the entry pointer being NULL inside the loop. The only case where this can happen is when the list is not initialized with INIT_LIST_HEAD() and the memory is cleared with 0's. However clang-scan doesn't provide a trace path from allocation to list_for_each_entry_safe() call where this can be proved. So my guess is that clang-scan assumes that any value is possible for a given pointer passed as an argument. In that case many false-positives will appear, since it's assuming something that is not true most of the cases. This bug is moved to https://github.com/gluster/glusterfs/issues/964, and will be tracked there from now on. Visit GitHub issues URL for further details |