vfio/fsl-mc: prevent underflow in vfio_fsl_mc_mmap()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Oct 2020 11:29:47 +0000 (14:29 +0300)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 3 Nov 2020 18:07:19 +0000 (11:07 -0700)
commit69848cd6f0c1fb4f82ab255b730343a215ded013
tree42e2f57377c275cef4d7dfc99dfdef983f5a2771
parent09699e56dee946a16767021af97411ed6f4b3e6b
vfio/fsl-mc: prevent underflow in vfio_fsl_mc_mmap()

My static analsysis tool complains that the "index" can be negative.
There are some checks in do_mmap() which try to prevent underflows but
I don't know if they are sufficient for this situation.  Either way,
making "index" unsigned is harmless so let's do it just to be safe.

Fixes: 67247289688d ("vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Diana Craciun <diana.craciun@oss.nxp.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/fsl-mc/vfio_fsl_mc.c