Closed maci0 closed 8 years ago
This looks legit but isn't critical since it only impacts the splat
test utility.
Wow, I wrote that code 12 years ago... 2002-09-14 to be exact.
But I don't think there's a bug here. The static analysis posits the while condition on line 781 never succeeds. Therefore, the initialization in the loop on line 782 never happens, thereby allowing the assignment on line 787 to be undefined.
However, the while condition on line 781 must always evaluate true for a number of iterations. On line 779, px points to the new memory allocation from line 778; and on line 780, plast points to what will become the last (ie, 32nd) element of that allocation (since LIST_ALLOC is #define'd to be 32). Therefore, the while condition on line 781 (px < plast) will be true for 31 iterations, the memory allocation from line 778 will be initialized, and the assignment on line 787 will be valid.
BTW, plans are to eventually remove the spl list routines in favor of the zfs list routines.
Closing. There isn't really a bug here to fix and the plan remain to retire this code anyway.
Bug reported by the clang static analyzer.
Description: Assigned value is garbage or undefined File: /home/maci/Coding/spl/lib/list.c Line: 787