drm/amdkfd: fix some range checks in address watch ioctl
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 16 Jun 2015 10:49:32 +0000 (13:49 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Tue, 16 Jun 2015 12:42:26 +0000 (15:42 +0300)
commit7861c7a4ca5c637f3cad1e343602a15e857140fd
tree00f1595dd1de98ce349596b1fddff9e3a09ed7bc
parent6876f98bfe7751a9ee0cd88390912df305e25183
drm/amdkfd: fix some range checks in address watch ioctl

buf_size_in_bytes must be large enough to hold ->num_watch_points and
watch_mode so I have added a sizeof(int) * 2 to the minimum size.

Also we have to subtract sizeof(*args) from the max args_idx limit so
that it matches the allocation.  Also I changed a > to >= for the last
compare.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c