]> sourceware.org Git - lvm2.git/log
lvm2.git
3 years agoconfigure.ac: improvement
Zdenek Kabelac [Thu, 14 Oct 2021 20:36:33 +0000 (22:36 +0200)]
configure.ac: improvement

Handle automatically new setttings

--disable-systemd-journal
--disable-appmachineid

Both setting will check presence of apropriate header files.
In case they are present, build will try to automatically build with
them (adding systemd dependency)

User can anytime disabled them and drop systemd dependency.

Also add --with-default-use-devices-file  configure option to
select automatically default value for this option.
For this moment keep default upstream as 0

3 years agomakefiles: use proper install prefix for python dbus
Zdenek Kabelac [Thu, 14 Oct 2021 19:39:14 +0000 (21:39 +0200)]
makefiles: use proper install prefix for python dbus

For non-standard prefix dir use correct installation path
(so the python files are not installed into user's system).

3 years agodebug: better error message
Zdenek Kabelac [Thu, 14 Oct 2021 16:44:55 +0000 (18:44 +0200)]
debug: better error message

Add more details about size difference.

3 years agoarchiving: update refactoring
Zdenek Kabelac [Thu, 14 Oct 2021 21:31:21 +0000 (23:31 +0200)]
archiving: update refactoring

Commit 5ea426e65628218569ede461312d80ba5d1c50fb handled case with
file path without '/' incorrectly - there is valid use-case so
switch 'log_error()' to valid code branch.

3 years agofix segfault handling duplicate PVs
David Teigland [Thu, 14 Oct 2021 19:02:59 +0000 (14:02 -0500)]
fix segfault handling duplicate PVs

cmd arg was missing when switching to use an alternative
duplicate dev.

3 years agofix lvmcache_add log_debug pvid
David Teigland [Wed, 13 Oct 2021 21:26:00 +0000 (16:26 -0500)]
fix lvmcache_add log_debug pvid

from previous cleanup

3 years agotoollib: remove all devices list from process_each_pv
David Teigland [Wed, 13 Oct 2021 19:13:54 +0000 (14:13 -0500)]
toollib: remove all devices list from process_each_pv

Reporting non-PVs / "all devices" is only done by
pvs -a or pvdisplay -a, so avoid the work managing
a list of all devices in process_each_pv.
In the case when it's needed, use the results of
label_scan which already determines which devs
are not PVs.

3 years agodevices file: unmatching system id should just be warning
David Teigland [Wed, 13 Oct 2021 18:34:46 +0000 (13:34 -0500)]
devices file: unmatching system id should just be warning

there are likely more cases than not where the systemid
does not match and the command should still run.

3 years agofix syslog setting
David Teigland [Mon, 11 Oct 2021 22:08:05 +0000 (17:08 -0500)]
fix syslog setting

Just setting lvm.conf level=N should not send messages to
syslog (now the journal by default.)

Sending messages to syslog should require setting lvm.conf
log { syslog=1 level=N }.

3 years agomake: generate
Marian Csontos [Fri, 6 Aug 2021 11:23:11 +0000 (13:23 +0200)]
make: generate

3 years agolvmdbusd: Use ID_FS_TYPE UDev property in udevwatch
Vojtech Trefny [Wed, 2 Jun 2021 15:17:40 +0000 (17:17 +0200)]
lvmdbusd: Use ID_FS_TYPE UDev property in udevwatch

'.ID_FS_TYPE_NEW' is a custom property added by an LVM UDev rule
which is now being removed and 'ID_FS_TYPE' has the same value.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
3 years agoconfigure: update
Marian Csontos [Mon, 26 Apr 2021 12:27:05 +0000 (14:27 +0200)]
configure: update

3 years agonew udev autoactivation
David Teigland [Fri, 26 Mar 2021 16:39:05 +0000 (11:39 -0500)]
new udev autoactivation

new udev rule 69-dm-lvm.rules replaces
69-dm-lvm-meta.rules and lvm2-pvscan.service

udev rule calls pvscan directly on the added device

pvscan output indicates if a complete VG can be activated

udev env var LVM_VG_NAME_COMPLETE is used to pass complete
VG name from pvscan to the udev rule

udev rule uses systemd-run to run vgchange -aay <vgname>

3 years agologging: to the systemd journal
David Teigland [Wed, 24 Mar 2021 19:19:54 +0000 (14:19 -0500)]
logging: to the systemd journal

Configure via lvm.conf log/journal or command line --journal.

Possible values:
"command" records command information.
"output" records default command output.
"debug" records full command debugging.

Multiple values can be set in lvm.conf as an array.
One value can be set in --journal which is added to
values set in lvm.conf

3 years agopvscan: add options listlvs listvg checkcomplete
David Teigland [Wed, 9 Dec 2020 16:59:40 +0000 (10:59 -0600)]
pvscan: add options listlvs listvg checkcomplete

pvscan --cache <dev>
    . read only dev
    . create online file for dev

pvscan --listvg <dev>
    . read only dev
    . list VG using dev

pvscan --listlvs <dev>
    . read only dev
    . list VG using dev
    . list LVs using dev

pvscan --cache --listvg [--checkcomplete] <dev>
    . read only dev
    . create online file for dev
    . list VG using dev
    . [check online files and report if VG is complete]

pvscan --cache --listlvs [--checkcomplete] <dev>
    . read only dev
    . create online file for dev
    . list VG using dev
    . list LVs using dev
    . [check online files and report if VG is complete]
    . [check online files and report if LVs are complete]

[--vgonline]
can be used with --checkcomplete, to enable use of a vg online
file.  This results in only the first pvscan command to see
the complete VG to report 'VG complete', and others will report
'VG finished'.  This allows the caller to easily run a single
activation of the VG.

[--udevoutput]
can be used with --cache --listvg --checkcomplete, to enable
an output mode that prints LVM_VG_NAME_COMPLETE='vgname' that
a udev rule can import, and prevents other output from the
command (other output causes udev to ignore the command.)

The list of complete LVs is meant to be passed to lvchange -aay,
or the complete VG used with vgchange -aay.

When --checkcomplete is used, lvm assumes that that the output
will be used to trigger event-based autoactivation, so the pvscan
does nothing if event_activation=0 and --checkcomplete is used.

Example of listlvs
------------------

$ lvs -a vg -olvname,devices
  LV     Devices
  lv_a   /dev/loop0(0)
  lv_ab  /dev/loop0(1),/dev/loop1(1)
  lv_abc /dev/loop0(3),/dev/loop1(3),/dev/loop2(1)
  lv_b   /dev/loop1(0)
  lv_c   /dev/loop2(0)

$ pvscan --cache --listlvs --checkcomplete /dev/loop0
  pvscan[35680] PV /dev/loop0 online, VG vg incomplete (need 2).
  VG vg incomplete
  LV vg/lv_a complete
  LV vg/lv_ab incomplete
  LV vg/lv_abc incomplete

$ pvscan --cache --listlvs --checkcomplete /dev/loop1
  pvscan[35681] PV /dev/loop1 online, VG vg incomplete (need 1).
  VG vg incomplete
  LV vg/lv_b complete
  LV vg/lv_ab complete
  LV vg/lv_abc incomplete

$ pvscan --cache --listlvs --checkcomplete /dev/loop2
  pvscan[35682] PV /dev/loop2 online, VG vg is complete.
  VG vg complete
  LV vg/lv_c complete
  LV vg/lv_abc complete

Example of listvg
-----------------

$ pvscan --cache --listvg --checkcomplete /dev/loop0
  pvscan[35684] PV /dev/loop0 online, VG vg incomplete (need 2).
  VG vg incomplete

$ pvscan --cache --listvg --checkcomplete /dev/loop1
  pvscan[35685] PV /dev/loop1 online, VG vg incomplete (need 1).
  VG vg incomplete

$ pvscan --cache --listvg --checkcomplete /dev/loop2
  pvscan[35686] PV /dev/loop2 online, VG vg is complete.
  VG vg complete

3 years agosystem_id: new appmachineid option
David Teigland [Wed, 20 May 2020 15:59:38 +0000 (10:59 -0500)]
system_id: new appmachineid option

The new system_id_source="appmachineid" will cause
lvm to use an lvm-specific derivation of the machine-id,
instead of the machine-id directly.  This is now
recommended in place of using machineid.

3 years agoconfig: change default use_devicesfile to 1
David Teigland [Tue, 16 Mar 2021 14:52:13 +0000 (09:52 -0500)]
config: change default use_devicesfile to 1

3 years agoconfig: comment all default settings
David Teigland [Tue, 16 Mar 2021 14:51:41 +0000 (09:51 -0500)]
config: comment all default settings

3 years agocleanup: use dm_list_empty
Zdenek Kabelac [Fri, 1 Oct 2021 12:30:49 +0000 (14:30 +0200)]
cleanup: use dm_list_empty

Instant check for 'dm_list_size() == 0' without any size calc.

3 years agocleanup: skip zeroing buffer overwritten by memcpy
Zdenek Kabelac [Fri, 1 Oct 2021 12:25:59 +0000 (14:25 +0200)]
cleanup: skip zeroing buffer overwritten by memcpy

Since the buffer is going to be overwritten by memcpy, reset only last
char to 0.

Also more use of DM_LIST_INIT list.h macro.

3 years agocleanup: all lvmcache_add users pass char with 0
Zdenek Kabelac [Fri, 1 Oct 2021 12:10:39 +0000 (14:10 +0200)]
cleanup: all lvmcache_add users pass char with 0

No local copy needed, both users submit zero-end string as pv/vgid.

3 years agocleanup: always initialize historical ptr
Zdenek Kabelac [Fri, 1 Oct 2021 11:53:28 +0000 (13:53 +0200)]
cleanup: always initialize historical ptr

Set ptr for all paths.

3 years agocleanup: remove unused code
Zdenek Kabelac [Fri, 1 Oct 2021 11:47:43 +0000 (13:47 +0200)]
cleanup: remove unused code

3 years agoarchiving: refactor code to allocate less memory
Zdenek Kabelac [Fri, 1 Oct 2021 14:19:53 +0000 (16:19 +0200)]
archiving: refactor code to allocate less memory

Do not store full path with each archived name reduces memory usage if
the directory has thousands of entries and just add 'dir' path when
needed.

Also emit info print message to a user if the total size of archived
files for a VG is more then 128MiB or 8192 files.

TODO: Consider wheather adding a new 'lvm.conf  archive{option}' to support
trimming these wild archive sizes can make situation better.
We already support retain_min && retain_days  - but if user is
generating too many and too large archives with minutes - maybe archiving
should be disabled by a user - as it's not producing anything largely usable
and just slows-down command ??
If we add 'retain_max & retain_max_size' the condition will go against
each other and we need to chose priorities.

mm

3 years agometadata: enhance internal error
Zdenek Kabelac [Fri, 1 Oct 2021 11:45:34 +0000 (13:45 +0200)]
metadata: enhance internal error

Consider missing config tree from vg read to be an internal error
since we do not want to 'regenerate' this one in expesive parsing way.

Also if there is any failure on recreating committed VG, make it also
a 'vg_write' error.

3 years agodebug: fix stack tracing
Zdenek Kabelac [Fri, 1 Oct 2021 11:44:17 +0000 (13:44 +0200)]
debug: fix stack tracing

Emit stack trace only on log_error path, and avoid on 'expected'
not-found path.

3 years agometadata: simplify code
Zdenek Kabelac [Fri, 1 Oct 2021 11:43:46 +0000 (13:43 +0200)]
metadata: simplify code

3 years agodevice_id: update stacked PVs for vgchange uuid
David Teigland [Mon, 4 Oct 2021 20:47:25 +0000 (15:47 -0500)]
device_id: update stacked PVs for vgchange uuid

If a VG uuid is changed, update the device_id of any
PVs stacked on LVs in the changed VG.

3 years agohandle bad metadata text in vg_read path
David Teigland [Tue, 28 Sep 2021 19:58:03 +0000 (14:58 -0500)]
handle bad metadata text in vg_read path

Corrupt metadata text (with good mda header) was being handled
in the label_scan phase, but not in the vg_read phase.  This
was sufficient because metadata areas would always be read and
checksummed during label_scan (metadata parsing was skipped
previously as an optimization.)

This changed with the optimization in
commit 61a6f9905e87e650f0bddae83fec6923bb100a57
"metadata: optimize reading metadata copies in scan"

Now, some metadata areas will not be read and checksummed
at all during the label_scan phase, only during the vg_read
phase.  This means that bad metadata text may first be detected
in the vg_read phase.  So, add equivalent bad metadata handling
to the vg_read path to match the label_scan path.

3 years agodebug: shorter code
Zdenek Kabelac [Mon, 27 Sep 2021 09:52:16 +0000 (11:52 +0200)]
debug: shorter code

3 years agocleanup: use already known lv size
Zdenek Kabelac [Mon, 27 Sep 2021 09:00:53 +0000 (11:00 +0200)]
cleanup: use already known lv size

3 years agocleanup: reuse existing code for free path
Zdenek Kabelac [Mon, 27 Sep 2021 09:42:45 +0000 (11:42 +0200)]
cleanup: reuse existing code for free path

3 years agocleanup: use first parameter uint
Zdenek Kabelac [Fri, 24 Sep 2021 20:16:07 +0000 (22:16 +0200)]
cleanup: use first parameter uint

Easier with struct zeroing and matching assing of type uint.

3 years agocov; matching enum type
Zdenek Kabelac [Fri, 24 Sep 2021 20:14:53 +0000 (22:14 +0200)]
cov; matching enum type

3 years agocov: ignoring
Zdenek Kabelac [Fri, 24 Sep 2021 20:08:26 +0000 (22:08 +0200)]
cov: ignoring

3 years agomake: build without versionsort
Zdenek Kabelac [Fri, 24 Sep 2021 21:04:37 +0000 (23:04 +0200)]
make: build without versionsort

Reported-by: adamboardman of gemian
3 years agomake: opened can be needed for either defines case
Zdenek Kabelac [Fri, 24 Sep 2021 15:46:09 +0000 (17:46 +0200)]
make: opened can be needed for either defines case

Reported-by: adamboardman of gemian
3 years agomake: replace legacy use rindex with strrchr
Zdenek Kabelac [Fri, 24 Sep 2021 15:40:35 +0000 (17:40 +0200)]
make: replace legacy use rindex with strrchr

Seems already dropped by some systems.

Reported-by: adamboardman of gemian
3 years agomake: fix compilation for undefined RAID_INTERNAL
Zdenek Kabelac [Fri, 24 Sep 2021 15:36:29 +0000 (17:36 +0200)]
make: fix compilation for undefined RAID_INTERNAL

Reported-by: adamboardman of gemian
3 years agomake: fix compilation for some compiler
Zdenek Kabelac [Fri, 24 Sep 2021 15:18:30 +0000 (17:18 +0200)]
make: fix compilation for some compiler

Reported-by: adamboardman of gemian
3 years agoutils: define macro for ffs
Zdenek Kabelac [Fri, 24 Sep 2021 19:43:30 +0000 (21:43 +0200)]
utils: define macro for ffs

Provide ffs() macro using __builtin_ffs(), when there is missing
ffs() implementation in header file.

Reported-by: adamboardman of gemian
3 years agoconfigure: replace AC_HELP_STRING with AS_
Zdenek Kabelac [Fri, 24 Sep 2021 16:06:28 +0000 (18:06 +0200)]
configure: replace AC_HELP_STRING with AS_

Upgrade to newer autoconf setup is approaching...
Will cause large set of configure changes.

3 years agoconfigure: check ffs __builtin_ffs versionsort
Zdenek Kabelac [Fri, 24 Sep 2021 16:04:39 +0000 (18:04 +0200)]
configure: check ffs __builtin_ffs versionsort

Check for presence of ffs(), __builtin_ffs() and versionsort().

3 years agocov: make more obvious buffer is zero ended
Zdenek Kabelac [Fri, 24 Sep 2021 12:25:40 +0000 (14:25 +0200)]
cov: make more obvious buffer is zero ended

3 years agometadata: avoid excessive check of /etc/localtime
Zdenek Kabelac [Mon, 27 Sep 2021 13:52:41 +0000 (15:52 +0200)]
metadata: avoid excessive check of /etc/localtime

With larger metadata, decoding 'localtime()' for hinting time creation
of every LV may cause excessive check of /etc/localtime file.
Set TZ to ":/etc/localtime" so glibc reads this file just once
instead of check everytime if there has anything changed.

3 years agometadata: optimize reading metadata copies in scan
Zdenek Kabelac [Mon, 27 Sep 2021 15:14:56 +0000 (17:14 +0200)]
metadata: optimize reading metadata copies in scan

While being in lockless scanning phase, we can avoid reading and checking
matching metadata copies if we already know them from other PV
and just rely on matching metadata header information.

These copies will be examined later during locked metadata read/write
access.

This patch may postpone discovering some read failures to locked phase.

3 years agometadata: remember parsing size of VG metadata
Zdenek Kabelac [Mon, 27 Sep 2021 13:55:53 +0000 (15:55 +0200)]
metadata: remember parsing size of VG metadata

When creating lvm2 metadata for VG, lvm2 allocate some buffer,
and if buffer is not big enough, the buffer is 'reallocated' bigger,
and whole metadata creation is repeated until metadata fits.
We can try to use 'previous' metadata size as hint to reduce looping
here.

3 years agometadata: remember crc32 when writing vg metadata
Zdenek Kabelac [Mon, 27 Sep 2021 09:41:03 +0000 (11:41 +0200)]
metadata: remember crc32 when writing vg metadata

Preserve computed crc32 check from first written PV, just like we
preserve generated metadata.

Also there is no need to call crc32 twice on wrapping buffer with 2 calcs,
result must be always the same as with single crc32 checking.

3 years agodmsetup: fix measure handling
Zdenek Kabelac [Mon, 27 Sep 2021 16:26:35 +0000 (18:26 +0200)]
dmsetup: fix measure handling

Previous patch f853a1bc7afdebb44aeb8c1167e8784d155cad84 enabled
ima measurement unconditionally for every status call,
but it needs to be set only for 'dmsetup measure' command.

3 years agolvmlockd: update error message
David Teigland [Fri, 24 Sep 2021 20:39:36 +0000 (15:39 -0500)]
lvmlockd: update error message

refer specifically to the "use_lvmlockd" setting in lvm.conf

3 years agodevicemapper: in sync with libdm
Zdenek Kabelac [Wed, 22 Sep 2021 15:30:42 +0000 (17:30 +0200)]
devicemapper: in sync with libdm

3 years agolibdm: dmsetup measure support for IMA
Alasdair G Kergon [Tue, 13 Jul 2021 01:06:04 +0000 (02:06 +0100)]
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)

3 years agodevicemapper: add DM_NAME_LIST_FLAG
Zdenek Kabelac [Wed, 22 Sep 2021 19:24:39 +0000 (21:24 +0200)]
devicemapper: add DM_NAME_LIST_FLAG

Match libdm part

3 years agolibdm: support DM_NAME_LIST_FLAG
Zdenek Kabelac [Wed, 22 Sep 2021 19:22:59 +0000 (21:22 +0200)]
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.

3 years agogcc: match types
Zdenek Kabelac [Wed, 22 Sep 2021 14:45:33 +0000 (16:45 +0200)]
gcc: match types

3 years agogcc: use more zero length arrays
Zdenek Kabelac [Wed, 22 Sep 2021 15:05:09 +0000 (17:05 +0200)]
gcc: use more zero length arrays

Define last array struct member with zero size.

3 years agomake: generate
Zdenek Kabelac [Wed, 22 Sep 2021 12:48:58 +0000 (14:48 +0200)]
make: generate

3 years agotests: raise required version for conversion
Zdenek Kabelac [Tue, 21 Sep 2021 19:43:02 +0000 (21:43 +0200)]
tests: raise required version for conversion

Real conversion needs this version driver.
TODO: handle properly older versions.

3 years agocov: ignore leak of fd descriptor
Zdenek Kabelac [Tue, 21 Sep 2021 18:20:53 +0000 (20:20 +0200)]
cov: ignore leak of fd descriptor

There is no 'fd' leak.

3 years agocov: check dev_get_size result
Zdenek Kabelac [Tue, 21 Sep 2021 16:50:26 +0000 (18:50 +0200)]
cov: check dev_get_size result

Check we have obtained some device size out of dev_get_size().

3 years agocov: sanitize function environment
Zdenek Kabelac [Tue, 21 Sep 2021 16:46:52 +0000 (18:46 +0200)]
cov: sanitize function environment

Coverity can see that function is either used with 'dev' or 'def'.

3 years agocov: check for function result
Zdenek Kabelac [Tue, 21 Sep 2021 16:45:08 +0000 (18:45 +0200)]
cov: check for function result

3 years agocov: check strchr for NULL
Zdenek Kabelac [Tue, 21 Sep 2021 16:24:30 +0000 (18:24 +0200)]
cov: check strchr for NULL

Although unlikely, ensuring coverity we not use NULL.

3 years agocov: ensuring buffer is zeroed
Zdenek Kabelac [Tue, 21 Sep 2021 16:13:05 +0000 (18:13 +0200)]
cov: ensuring buffer is zeroed

3 years agogcc-fanalyzer: zallocate memory for clean buffer
Zdenek Kabelac [Tue, 21 Sep 2021 16:36:44 +0000 (18:36 +0200)]
gcc-fanalyzer: zallocate memory for clean buffer

3 years agogcc-fanalyzer: remove unneded zeroing
Zdenek Kabelac [Tue, 21 Sep 2021 16:09:45 +0000 (18:09 +0200)]
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.

3 years agogcc-fanalyzer: helping understand answer is not null
Zdenek Kabelac [Tue, 21 Sep 2021 16:32:21 +0000 (18:32 +0200)]
gcc-fanalyzer: helping understand answer is not null

gcc can't easily see pointer 'answer' is only being checked once 'ret > 0'.

3 years agoclang: check for buffer existance
Zdenek Kabelac [Tue, 21 Sep 2021 16:07:41 +0000 (18:07 +0200)]
clang: check for buffer existance

Make obvious to analyzer we can't get NULL here.

3 years agoshellcheck: warning enhancements
Zdenek Kabelac [Tue, 21 Sep 2021 16:02:50 +0000 (18:02 +0200)]
shellcheck: warning enhancements

3 years agoshellcheck: tests fixes
Zdenek Kabelac [Tue, 21 Sep 2021 14:59:21 +0000 (16:59 +0200)]
shellcheck: tests fixes

Correcting some shell problems.

3 years agolvmcache: follow pv_id/pvid naming convention
David Teigland [Mon, 20 Sep 2021 14:32:21 +0000 (09:32 -0500)]
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

3 years agotests: len always initialized
Zdenek Kabelac [Mon, 20 Sep 2021 14:24:08 +0000 (16:24 +0200)]
tests: len always initialized

3 years agogcc: avoid name colision with function pv_id() from metadata.h
Zdenek Kabelac [Mon, 20 Sep 2021 14:12:10 +0000 (16:12 +0200)]
gcc: avoid name colision with function pv_id() from metadata.h

3 years agogcc: avoid warns on missing braces with older version
Zdenek Kabelac [Mon, 20 Sep 2021 14:11:49 +0000 (16:11 +0200)]
gcc: avoid warns on missing braces with older version

3 years agotests: a bit more fancy way to initialized struct
Zdenek Kabelac [Mon, 20 Sep 2021 14:01:22 +0000 (16:01 +0200)]
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.

3 years agocleanup: better wording
Zdenek Kabelac [Mon, 20 Sep 2021 13:41:14 +0000 (15:41 +0200)]
cleanup: better wording

Follow-up advice of native speaker.

3 years agocov: mask some warning about leakage
Zdenek Kabelac [Sun, 19 Sep 2021 18:21:55 +0000 (20:21 +0200)]
cov: mask some warning about leakage

Mask false-positive leak report.

3 years agocov: hide reports from optarg being NULL
Zdenek Kabelac [Sun, 19 Sep 2021 18:19:52 +0000 (20:19 +0200)]
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.

3 years agocov: ignore syscall
Zdenek Kabelac [Sun, 19 Sep 2021 23:45:55 +0000 (01:45 +0200)]
cov: ignore syscall

3 years agocov: validate syscall result
Zdenek Kabelac [Mon, 20 Sep 2021 08:31:45 +0000 (10:31 +0200)]
cov: validate syscall result

3 years agocov: test for fixture being NULL pointer
Zdenek Kabelac [Mon, 20 Sep 2021 08:28:07 +0000 (10:28 +0200)]
cov: test for fixture being NULL pointer

Explicit check for teoretical NULL pointer passed as fixture.

3 years agocov: capture runtime exception
Zdenek Kabelac [Mon, 20 Sep 2021 08:26:26 +0000 (10:26 +0200)]
cov: capture runtime exception

3 years agocov: better defined constructors
Zdenek Kabelac [Mon, 20 Sep 2021 08:26:05 +0000 (10:26 +0200)]
cov: better defined constructors

Ensure C++ initializes all struct members.
Also some deterministic buffer initialization.

3 years agocov: add explicit NULL pointer check
Zdenek Kabelac [Mon, 20 Sep 2021 08:24:30 +0000 (10:24 +0200)]
cov: add explicit NULL pointer check

Make obvious to coverity strcmp() is not getting NULL pointer.

3 years agocov: make read buffer obviously zero ended
Zdenek Kabelac [Sun, 19 Sep 2021 23:57:06 +0000 (01:57 +0200)]
cov: make read buffer obviously zero ended

Coverity doesn't get the idea from memset() here.

3 years agocov: check for possible NULL segtype
Zdenek Kabelac [Sun, 19 Sep 2021 23:51:29 +0000 (01:51 +0200)]
cov: check for possible NULL segtype

Although likely impossible to ever miss ERROR segtype,
make analyzer hapier.

3 years agocov: ensure data is not derefenced
Zdenek Kabelac [Sun, 19 Sep 2021 23:46:43 +0000 (01:46 +0200)]
cov: ensure data is not derefenced

Ensure all hypothetical paths cannot dereference NULL *(u->data).

3 years agocov: handle better leak reports
Zdenek Kabelac [Sun, 19 Sep 2021 18:27:34 +0000 (20:27 +0200)]
cov: handle better leak reports

Rewrite code so the leaks are eliminated from Coverity.

3 years agocov: use different variable name
Zdenek Kabelac [Sun, 19 Sep 2021 18:25:58 +0000 (20:25 +0200)]
cov: use different variable name

Better for Coverity to see no change for possibly opened handle.

3 years agocov: better handle reallocation of adapt_file
Zdenek Kabelac [Sun, 19 Sep 2021 18:24:35 +0000 (20:24 +0200)]
cov: better handle reallocation of adapt_file

If the option would be given more then once.

3 years agocov: handle teoretical sysconf failure
Zdenek Kabelac [Sun, 19 Sep 2021 18:23:24 +0000 (20:23 +0200)]
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.

3 years agocov: check fid instance is created
Zdenek Kabelac [Mon, 20 Sep 2021 00:09:16 +0000 (02:09 +0200)]
cov: check fid instance is created

3 years agocov: add error path for daemon_request_extend
Zdenek Kabelac [Sun, 19 Sep 2021 23:48:30 +0000 (01:48 +0200)]
cov: add error path for daemon_request_extend

Check for errors in daemon_request_extend().

3 years agocov: pvck validates setup_device return value
Zdenek Kabelac [Mon, 20 Sep 2021 08:33:33 +0000 (10:33 +0200)]
cov: pvck validates setup_device return value

3 years agotests: use single funtion to get random value
Zdenek Kabelac [Mon, 20 Sep 2021 08:32:32 +0000 (10:32 +0200)]
tests: use single funtion to get random value

3 years agotests: fix test of read buffer
Zdenek Kabelac [Sun, 19 Sep 2021 18:17:22 +0000 (20:17 +0200)]
tests: fix test of read buffer

Patch 7aba7fe68b6da2ca8ec7b01f5730396d64426fb0 incorrectly
converted  SECTOR_SIZE * BLOCK_SIZE_SECTORS to sizeof(f->data).

3 years agogcc-fanalyzer: drop zeroing of pointers
Zdenek Kabelac [Mon, 20 Sep 2021 11:53:20 +0000 (13:53 +0200)]
gcc-fanalyzer: drop zeroing of pointers

This explicit pointer zeroing is not needed since
we use 'zalloced' buffers.

3 years agogcc-fanalyzer: rewrite _fetch_string
Zdenek Kabelac [Mon, 20 Sep 2021 11:51:20 +0000 (13:51 +0200)]
gcc-fanalyzer: rewrite _fetch_string

Slightly more optimal code, that is less confusing analyzers.

3 years agogcc-fanalyzer: some explicit NULL checks for tests
Zdenek Kabelac [Sat, 18 Sep 2021 18:28:56 +0000 (20:28 +0200)]
gcc-fanalyzer: some explicit NULL checks for tests

Testing code being happier with these extra checks...

3 years agogcc-fanalyzer: better losetup error path
Zdenek Kabelac [Sat, 18 Sep 2021 19:00:49 +0000 (21:00 +0200)]
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.

This page took 0.078211 seconds and 5 git commands to generate.