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

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 1 14:28:17 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.8.2.vz7.151.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.8.2.vz7.151.9
------>
commit bd62a6712a2ac2b62b49805d5a97a96469c00fa4
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Mon Jun 1 14:28:17 2020 +0300

    ploop: variable dereferenced before check 'fbd' in ploop_fb_get_reloc_block
    
    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>
    Reviewed-by: Kirill Tkhai <ktkhai 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 e210421efa8b0..7a06b09a8e7df 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;


More information about the Devel mailing list