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 <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210105120239.28031-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Jiri Slaby authored and gregkh committed Mar 7, 2021
1 parent de00b8f commit 48549db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/vt/consolemap.c
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 48549db

Please sign in to comment.