Zdenek Kabelac
b0d40109a6
cov: ignore leak of fd descriptor
...
There is no 'fd' leak.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
e6d3587482
cov: check dev_get_size result
...
Check we have obtained some device size out of dev_get_size().
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
30e27d2f8b
cov: sanitize function environment
...
Coverity can see that function is either used with 'dev' or 'def'.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
a13dfcbc77
cov: check for function result
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
7bd55f8c15
cov: check strchr for NULL
...
Although unlikely, ensuring coverity we not use NULL.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
377e326156
cov: ensuring buffer is zeroed
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
8c44597820
gcc-fanalyzer: zallocate memory for clean buffer
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
4ef8f7cde6
gcc-fanalyzer: remove unneded zeroing
...
Since we zallocate array here, we don't need to set to NULL
and clean gcc warning about strdup leakage.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
178df1c8f4
gcc-fanalyzer: helping understand answer is not null
...
gcc can't easily see pointer 'answer' is only being checked once 'ret > 0'.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
462ac47003
clang: check for buffer existance
...
Make obvious to analyzer we can't get NULL here.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
bb6fd1a15f
shellcheck: warning enhancements
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
5bd99d55b0
shellcheck: tests fixes
...
Correcting some shell problems.
2021-09-21 21:03:47 +02:00
David Teigland
130993bab1
lvmcache: follow pv_id/pvid naming convention
...
name the variable pv_id_arg to follow the convention:
. "pvid" variable is null-terminated string
. "pv_id" variable is non-null-terminated struct
2021-09-20 09:35:47 -05:00
Zdenek Kabelac
b1f33a4000
tests: len always initialized
2021-09-20 16:24:08 +02:00
Zdenek Kabelac
133686ebc7
gcc: avoid name colision with function pv_id() from metadata.h
2021-09-20 16:12:10 +02:00
Zdenek Kabelac
2e990d1fec
gcc: avoid warns on missing braces with older version
2021-09-20 16:11:49 +02:00
Zdenek Kabelac
1a8a33ae9b
tests: a bit more fancy way to initialized struct
...
Older g++ is not smart enough to figure this out, so add a bit more push.
2021-09-20 16:01:22 +02:00
Zdenek Kabelac
4c0354fe0f
cleanup: better wording
...
Follow-up advice of native speaker.
2021-09-20 15:41:14 +02:00
Zdenek Kabelac
1b52451996
cov: mask some warning about leakage
...
Mask false-positive leak report.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
548c69f581
cov: hide reports from optarg being NULL
...
It's basically irrelavant which value we assing to optarg,
since it's set by getopt() function, but Coverity tool
is incorrectly reporting possibly dereference of NULL.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
efaab93491
cov: ignore syscall
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
055406bb39
cov: validate syscall result
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
9721f3e0ff
cov: test for fixture being NULL pointer
...
Explicit check for teoretical NULL pointer passed as fixture.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
3f946bfce7
cov: capture runtime exception
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
d5c82b0e73
cov: better defined constructors
...
Ensure C++ initializes all struct members.
Also some deterministic buffer initialization.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ebd150366f
cov: add explicit NULL pointer check
...
Make obvious to coverity strcmp() is not getting NULL pointer.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
752a9ec4b4
cov: make read buffer obviously zero ended
...
Coverity doesn't get the idea from memset() here.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
6c87e98ee3
cov: check for possible NULL segtype
...
Although likely impossible to ever miss ERROR segtype,
make analyzer hapier.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
bfc6fe2bac
cov: ensure data is not derefenced
...
Ensure all hypothetical paths cannot dereference NULL *(u->data).
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
3e7e9cc5e6
cov: handle better leak reports
...
Rewrite code so the leaks are eliminated from Coverity.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
825e49a244
cov: use different variable name
...
Better for Coverity to see no change for possibly opened handle.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
376e707232
cov: better handle reallocation of adapt_file
...
If the option would be given more then once.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ce907bcd26
cov: handle teoretical sysconf failure
...
sysconf() may also return -1 although rather theoretically.
Default to 4K when such case would happen.
Also in function call it just once and keep as static variable.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
f410035181
cov: check fid instance is created
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
e1840dd9e0
cov: add error path for daemon_request_extend
...
Check for errors in daemon_request_extend().
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
6427803252
cov: pvck validates setup_device return value
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
b6e9892bc6
tests: use single funtion to get random value
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
a428856a21
tests: fix test of read buffer
...
Patch 7aba7fe68b
incorrectly
converted SECTOR_SIZE * BLOCK_SIZE_SECTORS to sizeof(f->data).
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
becffe4567
gcc-fanalyzer: drop zeroing of pointers
...
This explicit pointer zeroing is not needed since
we use 'zalloced' buffers.
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
909401226c
gcc-fanalyzer: rewrite _fetch_string
...
Slightly more optimal code, that is less confusing analyzers.
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
30b188857c
gcc-fanalyzer: some explicit NULL checks for tests
...
Testing code being happier with these extra checks...
2021-09-20 14:17:46 +02:00
Zdenek Kabelac
9512638656
gcc-fanalyzer: better losetup error path
...
Fix leaking memory on error path on _process_losetup_switches().
However real impact is close to zero as dm-loop target isn't really used.
2021-09-20 13:58:57 +02:00
Zdenek Kabelac
3e21c8524e
gcc-fanalyzer: add extra check for origin_from_cow
...
Make analyzer work easier with explicit check for internal error.
2021-09-20 13:58:57 +02:00
Zdenek Kabelac
93d565eda9
gcc-fanalyzer: use zeroed memory
...
Analyzer here was rather confused about possiblity of loosing previously
assigned device pointers - fixed by passing zero initialize memory
before first assign.
2021-09-20 13:58:57 +02:00
Zdenek Kabelac
5126ac7c3a
gcc-fanalyzer: explicit test null not pass
...
Make analyzer explicitelly aware we can't get NULL here.
2021-09-20 10:51:30 +02:00
Zdenek Kabelac
e15d1e53c1
gcc-fanalyzer: notices 'du' could be NULL
...
Ensure only nonNULL 'du' pointer is dereference altough the comment
to the last assign 'du' pointer already suggest 'NULL' case should not happen.
So just being explicit.
mer du
2021-09-20 10:51:30 +02:00
Zdenek Kabelac
834f17bb33
clang: ensure new_len is at least 1
2021-09-20 10:51:30 +02:00
Zdenek Kabelac
0d9f3dbd95
clang: add explicit test for VG
...
Clang can't figure out connection to 'skip' variable.
2021-09-20 10:51:30 +02:00
Zdenek Kabelac
48163e32f1
lvmlockd: better error path
...
Set ->num to correct num of pointers.
and fixes regression from previous clang fix
9c5d2874a7
.
2021-09-20 10:49:56 +02:00
Zdenek Kabelac
a0bbdfba7f
cleanup: typo fix
2021-09-17 22:42:41 +02:00