mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/vmwgfx: remove an unnecessary check
@ 2017-04-11  8:45 Zhen Lei
  0 siblings, 0 replies; only message in thread
From: Zhen Lei @ 2017-04-11  8:45 UTC (permalink / raw)
  To: VMware Graphics, Sinclair Yeh, Thomas Hellstrom, David Airlie,
	DRM DRIVER, linux-kernel
  Cc: Zefan Li, Xinwei Hu, Tianhong Ding, Hanjun Guo, Zhen Lei

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).

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 05fa092..4520b1f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-11  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11  8:45 [PATCH 1/1] drm/vmwgfx: remove an unnecessary check Zhen Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®