提交 f22cf8eb 编写于 作者: D Dan Carpenter 提交者: Rusty Russell

virtio-blk: fix NULL checking in virtblk_alloc_req()

Smatch complains about the inconsistent NULL checking here.  Fix it to
return NULL on failure.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (fixed accidental deletion)
上级 c85a1f91
......@@ -90,10 +90,12 @@ static inline struct virtblk_req *virtblk_alloc_req(struct virtio_blk *vblk,
struct virtblk_req *vbr;
vbr = mempool_alloc(vblk->pool, gfp_mask);
if (vbr && use_bio)
sg_init_table(vbr->sg, vblk->sg_elems);
if (!vbr)
return NULL;
vbr->vblk = vblk;
if (use_bio)
sg_init_table(vbr->sg, vblk->sg_elems);
return vbr;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册