]> git.baikalelectronics.ru Git - kernel.git/commit
drm/msm: fix an integer overflow test
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 30 Jun 2017 07:59:15 +0000 (10:59 +0300)
committerRob Clark <robdclark@gmail.com>
Tue, 1 Aug 2017 20:23:55 +0000 (16:23 -0400)
commit34fb363bd53a647a8719e3a93f52cc29c1c82694
treec02b44b217bf30be76a71997aa9b8b18c0515161
parentde3f68fb3b74bee1d4bd4eed297ac8316be66415
drm/msm: fix an integer overflow test

We recently added an integer overflow check but it needs an additional
tweak to work properly on 32 bit systems.

The problem is that we're doing the right hand side of the assignment as
type unsigned long so the max it will have an integer overflow instead
of being larger than SIZE_MAX.  That means the "sz > SIZE_MAX" condition
is never true even on 32 bit systems.  We need to first cast it to u64
and then do the math.

Fixes: 63a87c0062de ("drm/msm: Fix potential buffer overflow issue")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/msm_gem_submit.c