Skip to content

Commit 2874211

Browse files
Dan Carpentermstsirkin
authored andcommitted
vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
There is a pointer math bug here so if "offset" is non-zero then this will copy memory from beyond the end of the array. Fixes: 1a86b37 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/20200808093241.GB115053@mwanda Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Eli Cohen <[email protected]> Cc: Jason Wang <[email protected]>; Parav Pandit <[email protected]>; [email protected]; [email protected]; [email protected] Fixes: 1a86b37 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") Signed-off-by: Dan Carpenter <[email protected]>
1 parent f31231b commit 2874211

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,7 @@ static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
17571757
struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
17581758

17591759
if (offset + len < sizeof(struct virtio_net_config))
1760-
memcpy(buf, &ndev->config + offset, len);
1760+
memcpy(buf, (u8 *)&ndev->config + offset, len);
17611761
}
17621762

17631763
static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, const void *buf,

0 commit comments

Comments
 (0)