]> git.baikalelectronics.ru Git - kernel.git/commit
drm/nouveau/fbcon: fix font width not divisible by 8
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 28 Jul 2016 22:56:13 +0000 (18:56 -0400)
committerBen Skeggs <bskeggs@redhat.com>
Sat, 30 Jul 2016 08:17:22 +0000 (18:17 +1000)
commit49c950c9aa0771d5b72f4b1529a89b94b8527b25
tree27b8fb9140941d3d30ba4689240890c1fd033e28
parentf668adab728e3119aceaf6aa32553c638c1d8ac6
drm/nouveau/fbcon: fix font width not divisible by 8

The patch 1dd6391afc66 ("drm/nouveau/fbcon: fix out-of-bounds memory accesses")
tries to fix some out of memory accesses. Unfortunatelly, the patch breaks the
display when using fonts with width that is not divisiable by 8.

The monochrome bitmap for each character is stored in memory by lines from top
to bottom. Each line is padded to a full byte.

For example, for 22x11 font, each line is padded to 16 bits, so each
character is consuming 44 bytes total, that is 11 32-bit words. The patch
1dd6391afc66 changed the logic to "dsize = ALIGN(image->width *
image->height, 32) >> 5", that is just 8 words - this is incorrect and it
causes display corruption.

This patch adds the necesary padding of lines to 8 bytes.

This patch should be backported to stable kernels where 1dd6391afc66 was
backported.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 1dd6391afc66 ("drm/nouveau/fbcon: fix out-of-bounds memory accesses")
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nv04_fbcon.c
drivers/gpu/drm/nouveau/nv50_fbcon.c
drivers/gpu/drm/nouveau/nvc0_fbcon.c