video: tegra: nvmap: Fix overflow in nvmap_heap
authorTuomas Tynkkynen <ttynkkynen@nvidia.com>
Mon, 13 Aug 2012 12:43:31 +0000 (15:43 +0300)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 08:25:48 +0000 (01:25 -0700)
commit58bc4037314ce545d64e72c7c35439523623fd3a
tree7546998f4022899ff207d1701be4f66973798310
parentcef20bd67fdd7071c79671817f06a8433b51c2e5
video: tegra: nvmap: Fix overflow in nvmap_heap

do_heap_alloc locates a suitable free block from a nvmap heap given a
size and alignment. Unfortunately, if a heap block happens to be
smaller than the alignment passed to the function, an integer overflow
will occur, and a block that's too small gets accidentally returned.

Bug 1032642

Change-Id: Ic650c520409134d753e968f62f144ddeb065ccc7
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Reviewed-on: http://git-master/r/123076
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>

Rebase-Id: R34de4da1a547ed1eb35d54bb7b1499142b80008a
drivers/video/tegra/nvmap/nvmap_heap.c