Skip to contentSkip to conversation

uninitialized pointer deref upon failed mirror addition

linux-lvm Jim Meyering 1 participant 1 message Jun 13, 2008

lore
Share & tools
lore
#0 lore raw

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.