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: 94abbccdf2
("vdpa/mlx5: Add shared memory registration code")
Addresses-Coverity: ("Uninitialized variables")
Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
Link: https://lore.kernel.org/r/20200806185625.67344-1-alex.dewar@gmx.co.uk
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Eli Cohen <eli@mellanox.com>
This commit is contained in:
parent
1e3e792650
commit
05acc4beb2
|
@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
|
|||
while (size) {
|
||||
sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
|
||||
dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
|
||||
if (!dmr)
|
||||
if (!dmr) {
|
||||
err = -ENOMEM;
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
dmr->start = st;
|
||||
dmr->end = st + sz;
|
||||
|
|
Loading…
Reference in New Issue