Skip to content

Fixes from clang

Zdenek Kabelac lvm-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest30 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/30Fix clang warning for ntohl(*((uint32_t *)buf))daemons/dmeventd/dmeventd.c daemons/dmeventd/libdevmapper-event.c+19 -181 reply
2/30Use dm_pool_grow_object embeded strlen for 0 deltalib/config/config.c lib/format_text/archive.c lib/metadata/lv_manip.c +3 more+10 -101 reply
2/30Use dm_pool_grow_object embeded strlen for 0 delta+0 -01 reply
3/30Check (type) is not NULL before accesslibdm/libdm-report.c+4 -31 reply
4/30Fix NULL pointer dereferencelib/format_text/format-text.c+1 -11 reply
5/30Print vg_name and do not to access vg->nametools/pvresize.c+1 -11 reply
6/30Ensure we always have origin definedtools/lvcreate.c+4 -01 reply
7/30Ensure seg is nonnulllib/activate/dev_manager.c+1 -11 reply
8/30Ensure first is not NULLlib/format1/format1.c+1 -11 reply
9/30Reuse result of previous strchr.tools/toollib.c+1 -11 reply
10/30Fix potential NULL pointer dereferencetools/lvm.c+3 -31 reply
11/30Fix theoretical usage of NULL pointer dereferencelibdm/regex/ttree.c+3 -11 reply
12/30Check for NULL pointertools/reporter.c+1 -10 replies
13/30Eliminate uninitialized_varlib/device/dev-md.c+2 -11 reply
13/30Eliminate uninitialized_var+0 -01 reply
14/30Fix missing initilisation to 0daemons/cmirrord/cluster.c+1 -11 reply
15/30Function pull_state cannot work with NULL bufferdaemons/cmirrord/functions.c+3 -11 reply
16/30Fix void* pointer arithmeticlib/mm/memlock.c+2 -22 replies
16/30Fix void* pointer arithmetic+0 -01 reply
16/30Fix void* pointer arithmetic+0 -00 replies
17/30Use const pvid for device_from_pvid()lib/cache/lvmcache.c lib/cache/lvmcache.h+2 -21 reply
18/30Use const pointer for return value of dm_basenamelibdm/libdevmapper.h libdm/libdm-string.c+4 -41 reply
19/30Fix constness warninglib/cache/lvmcache.c+4 -41 reply
20/30Fix constness warninglib/metadata/metadata.c+1 -11 reply
21/30Fix constness warninglib/misc/crc.c+3 -31 reply
22/30Fix constness warningtools/dmsetup.c+1 -11 reply
23/30Using const config nodelib/striped/striped.c+1 -11 reply
24/30bufused is assigned 0 in preceding source linelib/log/log.c+1 -11 reply
25/30Proper C declarationdaemons/dmeventd/dmeventd.c+2 -21 reply
26/30Use staticlibdm/mm/pool-fast.c+4 -41 reply
27/30Instrument compiler about code unreachabilitydaemons/clvmd/clvmd.c+5 -21 reply
28/30Skip uninitialized macro for scan-buildlib/misc/util.h+4 -01 reply
29/30Add some __attribute__ instrumentationlibdm/libdevmapper.h+13 -131 reply
29/30Add some __attribute__ instrumentation+0 -00 replies
30/30__attribute__((nonnull(1)))lib/device/dev-cache.h libdm/regex/ttree.c+3 -21 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/30] Fixes from clang

Patchset combines code cleanups for compiler warnings and code fixes found by static analyzer scan-build.

Potentional NULL pointer dereferencies are mostly in very unusual code execution paths. I've tried to order them on their importance - the later ones are not event trigerable as surrounding code should not be to pass problematic values - but checks seems to be simple enough to keep static analysis happy.

Last patches in this set add some instrumentation to function calls that might allow better code optimization or better static analysis.

Zdenek Kabelac (30):
Fix clang warning for ntohl(*((uint32_t *)buf)) Use dm_pool_grow_object embeded strlen for 0 delta Check (type) is not NULL before access
Fix NULL pointer dereference
Print vg_name and do not to access vg->name Ensure we always have origin defined Ensure seg is nonnull
Ensure first is not NULL
Reuse result of previous strchr.
Fix potential NULL pointer dereference
Fix theoretical usage of NULL pointer dereference Check for NULL pointer
Eliminate uninitialized_var
Fix missing initilisation to 0
Function pull_state cannot work with NULL buffer Fix void* pointer arithmetic
Use const pvid for device_from_pvid()
Use const pointer for return value of dm_basename Fix constness warning
Fix constness warning
Fix constness warning
Fix constness warning
Using const config node
bufused is assigned 0 in preceding source line Proper C declaration
Use static
Instrument compiler about code unreachability Skip uninitialized macro for scan-build Add some __attribute__ instrumentation __attribute__((nonnull(1)))

 daemons/clvmd/clvmd.c                 |    7 +++++--
 daemons/cmirrord/cluster.c            |    2 +-
 daemons/cmirrord/functions.c          |    4 +++-
 daemons/dmeventd/dmeventd.c           |   21 +++++++++++----------
 daemons/dmeventd/libdevmapper-event.c |   20 ++++++++++----------
 lib/activate/dev_manager.c            |    2 +-
 lib/cache/lvmcache.c                  |   10 +++++-----
 lib/cache/lvmcache.h                  |    2 +-
 lib/config/config.c                   |    2 +-
 lib/device/dev-cache.h                |    2 +-
 lib/device/dev-md.c                   |    3 ++-
 lib/format1/format1.c                 |    2 +-
 lib/format_text/archive.c             |    4 ++--
 lib/format_text/format-text.c         |    2 +-
 lib/log/log.c                         |    2 +-
 lib/metadata/lv_manip.c               |    2 +-
 lib/metadata/metadata.c               |    6 +++---
 lib/misc/crc.c                        |    6 +++---
 lib/misc/util.h                       |    4 ++++
 lib/mm/memlock.c                      |    4 ++--
 lib/report/report.c                   |    6 +++---
 lib/striped/striped.c                 |    2 +-
 libdm/libdevmapper.h                  |   28 ++++++++++++++--------------
 libdm/libdm-report.c                  |    7 ++++---
 libdm/libdm-string.c                  |    6 +++---
 libdm/mm/pool-fast.c                  |    8 ++++----
 libdm/regex/ttree.c                   |    7 +++++--
 tools/dmsetup.c                       |    2 +-
 tools/lvcreate.c                      |    4 ++++
 tools/lvm.c                           |    6 +++---
 tools/lvmcmdline.c                    |    2 +-
 tools/pvresize.c                      |    2 +-
 tools/reporter.c                      |    2 +-
 tools/toollib.c                       |    2 +-
 34 files changed, 105 insertions(+), 86 deletions(-)

--
1.7.3.1