Index: sys/dev/drm2/drmP.h =================================================================== --- sys/dev/drm2/drmP.h (revision 275189) +++ sys/dev/drm2/drmP.h (working copy) @@ -192,6 +192,7 @@ /*@{*/ #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) +#define DRM_ARRAY_LASTIDX(x) (DRM_ARRAY_SIZE(x) - 1) #define DRM_MIN(a,b) ((a)<(b)?(a):(b)) #define DRM_MAX(a,b) ((a)>(b)?(a):(b)) Index: sys/dev/drm2/drm_drv.c =================================================================== --- sys/dev/drm2/drm_drv.c (revision 275189) +++ sys/dev/drm2/drm_drv.c (working copy) @@ -906,7 +906,7 @@ /* The array entries begin at DRM_COMMAND_BASE ioctl nr */ nr -= DRM_COMMAND_BASE; if (nr > dev->driver->max_ioctl) { - DRM_DEBUG("Bad driver ioctl number, 0x%x (of 0x%x)\n", + DRM_DEBUG("Bad driver ioctl number, 0x%x (max is 0x%x)\n", nr, dev->driver->max_ioctl); return EINVAL; } Index: sys/dev/drm2/i915/i915_dma.c =================================================================== --- sys/dev/drm2/i915/i915_dma.c (revision 275189) +++ sys/dev/drm2/i915/i915_dma.c (working copy) @@ -1531,7 +1531,7 @@ .compat_ioctls = i915_compat_ioctls, .compat_ioctls_nr = &i915_compat_ioctls_nr, #endif - .max_ioctl = DRM_ARRAY_SIZE(i915_ioctls), + .max_ioctl = DRM_ARRAY_LASTIDX(i915_ioctls), .name = DRIVER_NAME, .desc = DRIVER_DESC, Index: sys/dev/drm2/radeon/radeon_drv.c =================================================================== --- sys/dev/drm2/radeon/radeon_drv.c (revision 275189) +++ sys/dev/drm2/radeon/radeon_drv.c (working copy) @@ -412,7 +412,7 @@ { driver = &driver_old; pdriver = &radeon_pci_driver; - driver->num_ioctls = radeon_max_ioctl; + driver->num_ioctls = radeon_max_ioctl + 1; #ifdef CONFIG_VGA_CONSOLE if (vgacon_text_force() && radeon_modeset == -1) { DRM_INFO("VGACON disable radeon kernel modesetting.\n"); @@ -437,7 +437,7 @@ driver = &kms_driver; pdriver = &radeon_kms_pci_driver; driver->driver_features |= DRIVER_MODESET; - driver->num_ioctls = radeon_max_kms_ioctl; + driver->num_ioctls = radeon_max_kms_ioctl + 1; radeon_register_atpx_handler(); } /* if the vga console setting is enabled still Index: sys/dev/drm2/radeon/radeon_kms.c =================================================================== --- sys/dev/drm2/radeon/radeon_kms.c (revision 275189) +++ sys/dev/drm2/radeon/radeon_kms.c (working copy) @@ -724,4 +724,4 @@ DRM_IOCTL_DEF_DRV(RADEON_GEM_BUSY, radeon_gem_busy_ioctl, DRM_AUTH|DRM_UNLOCKED), DRM_IOCTL_DEF_DRV(RADEON_GEM_VA, radeon_gem_va_ioctl, DRM_AUTH|DRM_UNLOCKED), }; -int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms); +int radeon_max_kms_ioctl = DRM_ARRAY_LASTIDX(radeon_ioctls_kms); Index: sys/dev/drm2/radeon/radeon_state.c =================================================================== --- sys/dev/drm2/radeon/radeon_state.c (revision 275189) +++ sys/dev/drm2/radeon/radeon_state.c (working copy) @@ -3259,4 +3259,4 @@ DRM_IOCTL_DEF_DRV(RADEON_CS, r600_cs_legacy_ioctl, DRM_AUTH) }; -int radeon_max_ioctl = DRM_ARRAY_SIZE(radeon_ioctls); +int radeon_max_ioctl = DRM_ARRAY_LASTIDX(radeon_ioctls);