]> git.baikalelectronics.ru Git - kernel.git/commit
vhost_vdpa: Fix potential underflow in vhost_vdpa_mmap()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 10 Jun 2020 08:58:52 +0000 (11:58 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 22 Jun 2020 16:34:21 +0000 (12:34 -0400)
commit41430edc35ad2b95bf15702c886fb28e631c806b
treea4e02555cb4414ee5a511125fbd063adafa31785
parent8c6ca802aa3c8274fb2b1c803d2db3574a79c02e
vhost_vdpa: Fix potential underflow in vhost_vdpa_mmap()

The "vma->vm_pgoff" variable is an unsigned long so if it's larger than
INT_MAX then "index" can be negative leading to an underflow.  Fix this
by changing the type of "index" to "unsigned long".

Fixes: 9f568aab5c84 ("vhost_vdpa: support doorbell mapping via mmap")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200610085852.GB5439@mwanda
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vdpa.c