Skip to content

Commit 870aaff

Browse files
Laura Abbottmstsirkin
authored andcommitted
vdpa: clean up get_config_size ret value handling
The return type of get_config_size is size_t so it makes sense to change the type of the variable holding its result. That said, this already got taken care of (differently, and arguably not as well) by commit 3ed21c1 ("vdpa: check that offsets are within bounds"). The added 'c->off > size' test in that commit will be done as an unsigned comparison on 32-bit (safe due to not being signed). On a 64-bit platform, it will be done as a signed comparison, but in that case the comparison will be done in 64-bit, and 'c->off' being an u32 it will be valid thanks to the extended range (ie both values will be positive in 64 bits). So this was a real bug, but it was already addressed and marked for stable. Signed-off-by: Laura Abbott <[email protected]> Reported-by: Luo Likang <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 1861ba6 commit 870aaff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vhost/vdpa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v,
195195
struct vhost_vdpa_config *c)
196196
{
197197
struct vdpa_device *vdpa = v->vdpa;
198-
long size = vdpa->config->get_config_size(vdpa);
198+
size_t size = vdpa->config->get_config_size(vdpa);
199199

200200
if (c->len == 0 || c->off > size)
201201
return -EINVAL;

0 commit comments

Comments
 (0)