vdpa: Fix pointer math bug in vdpasim_get_config()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 6 Apr 2020 14:45:52 +0000 (17:45 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 10 Aug 2020 14:38:55 +0000 (10:38 -0400)
commitcf16fe9243bfa2863491026fc727618c7c593c84
tree307e7504e850eb89fca913611f87b5d3fd81a125
parent2874211fcdb751e2962d68cdb9783fa1ff8eb340
vdpa: Fix pointer math bug in vdpasim_get_config()

If "offset" is non-zero then we end up copying from beyond the end of
the config because of pointer math.  We can fix this by casting the
struct to a u8 pointer.

Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200406144552.GF68494@mwanda
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/vdpa/vdpa_sim/vdpa_sim.c