Bug #7848
fs_getdents returns uninitialized variable in some cases causing false positive errors
Status:
New
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2017-02-08
Due date:
% Done:
0%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
Description
The return value of the function fs_getdents will be returned to the caller uninitialized
if *nbyte is not equal to 0 or lstat64 fails.
The function is here
http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/ndmpd/tlm/tlm_traverse.c#222
This causes that the caller fails with an error.
In my case
http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/ndmpd/tlm/tlm_traverse.c#669
Updated by Yuri Pankov about 4 years ago
Indeed. And that really asks for fixing warnings reported by gcc instead of silencing them:
cc1: warnings being treated as errors tlm/tlm_traverse.c: In function 'fs_getdents': tlm/tlm_traverse.c:236: error: 'rv' may be used uninitialized in this function [-Wuninitialized] *** Error code 1 make: Fatal error: Command failed for target `tlm/tlm_traverse.o'