Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vmwgfx: fix incorrect VRAM size check in vmw_kms_fb_create()
Commit e133e73 didn't correctly fix the integer overflow issue. - unsigned int required_size; + u64 required_size; ... required_size = mode_cmd->pitch * mode_cmd->height; - if (unlikely(required_size > dev_priv->vram_size)) { + if (unlikely(required_size > (u64) dev_priv->vram_size)) { Note that both pitch and height are u32. Their product is still u32 and would overflow before being assigned to required_size. A correct way is to convert pitch and height to u64 before the multiplication. required_size = (u64)mode_cmd->pitch * (u64)mode_cmd->height; This patch calls the existing vmw_kms_validate_mode_vram() for validation. Signed-off-by: Xi Wang <[email protected]> Reviewed-and-tested-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
- Loading branch information