Skip to content

Commit 05acc4b

Browse files
alexdewarmstsirkin
authored andcommitted
vdpa/mlx5: Fix uninitialised variable in core/mr.c
If the kernel is unable to allocate memory for the variable dmr then err will be returned without being set. Set err to -ENOMEM in this case. Fixes: 94abbcc ("vdpa/mlx5: Add shared memory registration code") Addresses-Coverity: ("Uninitialized variables") Signed-off-by: Alex Dewar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]> Acked-by: Eli Cohen <[email protected]>
1 parent 1e3e792 commit 05acc4b

File tree

1 file changed

+3
-1
lines changed
  • drivers/vdpa/mlx5/core

1 file changed

+3
-1
lines changed

drivers/vdpa/mlx5/core/mr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
319319
while (size) {
320320
sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
321321
dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
322-
if (!dmr)
322+
if (!dmr) {
323+
err = -ENOMEM;
323324
goto err_alloc;
325+
}
324326

325327
dmr->start = st;
326328
dmr->end = st + sz;

0 commit comments

Comments
 (0)