Whamcloud - gitweb
LU-17000 utils: Fix negative argument passed 96/53796/10
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Mon, 22 Jan 2024 16:09:19 +0000 (21:39 +0530)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Jun 2024 03:25:42 +0000 (03:25 +0000)
commit55831a3128d6b395fac19f88c81dc27d27fb690f
treed27570415425e366316055cfe79e8f59945d33b4
parent3ae78057501236ddb662041ba766109c25160152
LU-17000 utils: Fix negative argument passed

This patch fixes bunch of "Argument cannot be negative"
reported by Coverity.

CoverityID: 397713 ("Argument cannot be negative")
CoverityID: 397899 ("Argument cannot be negative")
Pass -rc to strerror() since rc is guaranteed to be negative.

CoverityID: 397769 ("Argument cannot be negative")
read() could return -1 on error. Check before using the value

CoverityID: 397780 ("Argument cannot be negative")
Use static allocation removing the need to call sysconf()

CoverityID: 403104 ("Argument cannot be negative")
On failure to open do not try to call close()

Fixes: 58d744e3 (LU-10092 pcc: Non-blocking PCC caching)
Fixes: f172b116 (LU-10092 llite: Add persistent cache on client)
Fixes: aed82919 (LU-16029 utils: add options to lr_reader to parse raw files)
Fixes: 86ba46c2 (LU-9680 obdclass: user netlink to collect devices information)
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Id51c6c184d30dce596e7ab948a6fd0768eed1503
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53796
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
lustre/utils/lfs.c
lustre/utils/liblustreapi_pcc.c
lustre/utils/liblustreapi_util.c
lustre/utils/lr_reader.c
lustre/utils/lustre_cfg.c