Zdenek Kabelac
a1cb33b633
devicemapper: in sync with libdm
2021-09-23 16:49:58 +02:00
Alasdair G Kergon
f853a1bc7a
libdm: dmsetup measure support for IMA
...
Add support for DM_IMA_MEASUREMENT_FLAG with
DM_TABLE_STATUS_CMD.
This feature requires DM version 4.45 (5.15+ kernels)
2021-09-23 16:49:28 +02:00
Zdenek Kabelac
707e7d762e
devicemapper: add DM_NAME_LIST_FLAG
...
Match libdm part
2021-09-23 16:49:16 +02:00
Zdenek Kabelac
566c2f1828
libdm: support DM_NAME_LIST_FLAG
...
Kernel patch 8b638081bd4520f63db1defc660666ec5f65bc15
introduced support to return UUID in DM_LIST_DEVICES_CMD.
Useful when asking for UUID of each device where the list
could be now returned directly with NAME && UUID for each device.
Returning UUID is done in backward-compatible way. There's one unused
32-bit word value after the event number. This patch sets the bit
DM_NAME_LIST_FLAG_HAS_UUID if UUID is present and
DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID if it isn't (if none of these bits is
set, then we have an old kernel that doesn't support returning UUIDs). The
UUID is stored after this word. The 'next' value is updated to point after
the UUID, so that old version of libdevmapper will skip the UUID without
attempting to interpret it.
2021-09-23 16:49:14 +02:00
Zdenek Kabelac
ee15065a0f
gcc: match types
2021-09-22 17:18:50 +02:00
Zdenek Kabelac
9eafd44734
gcc: use more zero length arrays
...
Define last array struct member with zero size.
2021-09-22 17:18:50 +02:00
Zdenek Kabelac
4515acf734
make: generate
2021-09-22 14:48:58 +02:00
Zdenek Kabelac
4cfa80f02f
tests: raise required version for conversion
...
Real conversion needs this version driver.
TODO: handle properly older versions.
2021-09-21 21:43:02 +02:00
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