Skip to content

Commit

Permalink
vt/consolemap: do font sum unsigned
Browse files Browse the repository at this point in the history
The constant 20 makes the font sum computation signed which can lead to
sign extensions and signed wraps. It's not much of a problem as we build
with -fno-strict-overflow. But if we ever decide not to, be ready, so
switch the constant to unsigned.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210105120239.28031-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Jan 7, 2021
1 parent 7d7dec4 commit 9777f8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/vt/consolemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ con_insert_unipair(struct uni_pagedir *p, u_short unicode, u_short fontpos)

p2[unicode & 0x3f] = fontpos;

p->sum += (fontpos << 20) + unicode;
p->sum += (fontpos << 20U) + unicode;

return 0;
}
Expand Down

0 comments on commit 9777f8e

Please sign in to comment.