From: Laura Abbott <labb...@kernel.org>

commit 0e1c61723d60074b12c61e69ffacd9137a60dd1d from
https://github.com/altera-opensource/linux-socfpga.git

[upstream commit 870aaff92e959e29d40f9cfdb5ed06ba2fc2dae0]

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 3ed21c1451a1 ("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 <labb...@kernel.org>
Reported-by: Luo Likang <luolik...@nsfocus.com>
Signed-off-by: Michael S. Tsirkin <m...@redhat.com>
Signed-off-by: Wenlin Kang <wenlin.k...@windriver.com>
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index b2d4b1139ab5..73ea4491c8b3 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -192,7 +192,7 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v,
                                      struct vhost_vdpa_config *c)
 {
        struct vdpa_device *vdpa = v->vdpa;
-       long size = vdpa->config->get_config_size(vdpa);
+       size_t size = vdpa->config->get_config_size(vdpa);
 
        if (c->len == 0 || c->off > size)
                return -EINVAL;
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12581): 
https://lists.yoctoproject.org/g/linux-yocto/message/12581
Mute This Topic: https://lists.yoctoproject.org/mt/98921502/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to