drm/vmwgfx: Fix a potential integer overflow
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 19 Jan 2017 19:01:04 +0000 (11:01 -0800)
committerSinclair Yeh <syeh@vmware.com>
Fri, 27 Jan 2017 04:52:51 +0000 (20:52 -0800)
Found by coverity.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

index 7d3cb7824fa136bcee333506eaefcb095eb07ffb..d492d57d53094a061ef0e2b735e3bca87efb5636 100644 (file)
@@ -1671,7 +1671,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
                 *      1. Bounding box (assuming 32bpp) must be < prim_bb_mem
                 *      2. Total pixels (assuming 32bpp) must be < prim_bb_mem
                 */
-               u64 bb_mem    = bounding_box.w * bounding_box.h * 4;
+               u64 bb_mem    = (u64) bounding_box.w * bounding_box.h * 4;
                u64 pixel_mem = total_pixels * 4;
 
                if (bb_mem > dev_priv->prim_bb_mem) {