[linux-lvm] uninitialized pointer deref upon failed mirror addition

Jim Meyering jim at meyering.net
Fri Jun 13 10:45:09 UTC 2008


While preparing an unrelated patch, I saw this warning go by,
so went and looked:

  metadata/mirror.c: In function 'add_mirror_images':
  metadata/mirror.c:1347: warning: 'log_lv' may be used uninitialized in this function

It turns out that it is a legitimate warning, indeed,
and an uninitialized log_lv will be dereferenced if any
of the "goto out_remove_log;" statements is reached with
log_count == 0 (aka log_lv uninitialized).

If someone can tell me precisely how to exercise one of the offending
code paths, I'll try to make time to write a test script that'd be run
via "make check".

Here's a proposed (but untested) fix.




More information about the linux-lvm mailing list