Skip to content

Commit

Permalink
vt/consolemap: do font sum unsigned
Browse files Browse the repository at this point in the history
[ Upstream commit 9777f8e ]

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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Jiri Slaby authored and gregkh committed Mar 7, 2021
1 parent e0c29b3 commit 136f009
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 136f009

Please sign in to comment.