• Mikulas Patocka's avatar
    drm/nouveau/fbcon: fix font width not divisible by 8 · ad41f2c0
    Mikulas Patocka authored
    commit 28668f43 upstream.
    
    The patch f045f459 ("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
    f045f459 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 f045f459 was
    backported.
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Fixes: f045f459 ("drm/nouveau/fbcon: fix out-of-bounds memory accesses")
    Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    ad41f2c0
nv04_fbcon.c 7.65 KB