]> git.baikalelectronics.ru Git - kernel.git/commit
drm: fix division-by-zero on dumb_create()
authorDavid Herrmann <dh.herrmann@gmail.com>
Sun, 24 Aug 2014 17:23:26 +0000 (19:23 +0200)
committerDave Airlie <airlied@redhat.com>
Thu, 28 Aug 2014 01:38:04 +0000 (11:38 +1000)
commitcc8813b6e9220e4dc4338d094be2c3f67bee2d4b
treef78c53805cf874e597290c8feaa4bb7282e669bb
parente3ba1c4b783e1a24081d326a65cc19fe98343acd
drm: fix division-by-zero on dumb_create()

Kinda unexpected, but DIV_ROUND_UP() can overflow if passed an argument
bigger than UINT_MAX - DIVISOR. Fix this by testing for "!cpp" before
using it in the following division.

Note that DIV_ROUND_UP() is defined as:
        #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))

..this will obviously overflow if (n + d - 1) is bigger than UINT_MAX.

Reported-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c