[Devel] [PATCH RH7] ploop: variable dereferenced before check 'fbd' in ploop_fb_get_reloc_block

Vasily Averin vvs at virtuozzo.com
Sun May 31 16:23:43 MSK 2020


found by smatch:
drivers/block/ploop/freeblks.c:469 ploop_fb_get_reloc_block() warn:
 variable dereferenced before check 'fbd' (see line 467)

Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 drivers/block/ploop/freeblks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/freeblks.c b/drivers/block/ploop/freeblks.c
index e210421..7a06b09 100644
--- a/drivers/block/ploop/freeblks.c
+++ b/drivers/block/ploop/freeblks.c
@@ -464,11 +464,12 @@ int ploop_fb_get_reloc_block(struct ploop_freeblks_desc *fbd,
 	cluster_t from_clu, to_clu;
 	iblock_t  from_iblk, to_iblk;
 	u32 free;
-	struct ploop_relocblks_extent *r_extent = fbd->fbd_lrb.ext;
+	struct ploop_relocblks_extent *r_extent;
 
 	if (!fbd)
 		return -1;
 
+	r_extent = fbd->fbd_lrb.ext;
 	/* whole range is drained? */
 	if (r_extent == NULL)
 		return -1;
-- 
1.8.3.1



More information about the Devel mailing list