[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 08/30] Ensure first is not NULL



clang Logic error	Dereference of null pointer

For empty lists make sure the NULL first pointer is not dereferenced.

Signed-off-by: Zdenek Kabelac <zkabelac redhat com>
---
 lib/format1/format1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/format1/format1.c b/lib/format1/format1.c
index 0dcec05..0efde31 100644
--- a/lib/format1/format1.c
+++ b/lib/format1/format1.c
@@ -103,7 +103,7 @@ static int _check_vgs(struct dm_list *pvs, struct volume_group *vg)
 	}
 
 	/* On entry to fn, list known to be non-empty */
-	if (pv_count != first->vgd.pv_cur) {
+	if (first && (pv_count != first->vgd.pv_cur)) {
 		log_error("%d PV(s) found for VG %s: expected %d",
 			  pv_count, first->pvd.vg_name, first->vgd.pv_cur);
 		vg->status |= PARTIAL_VG;
-- 
1.7.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]