[drm] Fix off-by-one error when accessing driver-specific ioctl handlers array

PR:		231513
Submitted by:	Young_X <YangX92@hotmail.com>
Approved by:	imp
MFC after:	1 week
This commit is contained in:
Oleksandr Tymoshenko 2019-01-15 21:06:58 +00:00
parent 396694153f
commit 89ec2f414c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343060

View File

@ -745,7 +745,7 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
if (ioctl->func == NULL && nr >= DRM_COMMAND_BASE) {
/* The array entries begin at DRM_COMMAND_BASE ioctl nr */
nr -= DRM_COMMAND_BASE;
if (nr > dev->driver->max_ioctl) {
if (nr >= dev->driver->max_ioctl) {
DRM_DEBUG("Bad driver ioctl number, 0x%x (of 0x%x)\n",
nr, dev->driver->max_ioctl);
return EINVAL;