Skip to contentSkip to conversation

drm/vmwgfx: remove an unnecessary check

PATCH New Zhen Lei 1 participant 1 message Apr 11, 2017

Subsystems (3)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 drm/vmwgfx: remove an unnecessary check

commit e7e11f995642 ("drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl()") ensures that each req->mip_levels[i] <= DRM_VMW_MAX_MIP_LEVELS, It would be easy to conclude that the sum of req->mip_levels[i] (i = 0, ..., DRM_VMW_MAX_SURFACE_FACES - 1) is less than or equal to (DRM_VMW_MAX_SURFACE_FACES * DRM_VMW_MAX_MIP_LEVELS).

---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +1 -2
index 05fa092..4520b1f 100644
@@ -719,8 +719,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
 		num_sizes += req->mip_levels[i];
 	}
 
-	if (num_sizes > DRM_VMW_MAX_SURFACE_FACES * DRM_VMW_MAX_MIP_LEVELS ||
-	    num_sizes == 0)
+	if (num_sizes == 0)
 		return -EINVAL;
 
 	size = vmw_user_surface_size + 128 +

--
2.5.0