Commit 32bd78fc authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

tty/vt: consolemap: zero uni_pgdir using kcalloc()

The newly allocated p->uni_pgdir[n] is initialized to NULLs right after
a kmalloc_array() allocation. Combine these two using kcalloc().
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220607104946.18710-11-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 92543654
...@@ -499,18 +499,16 @@ static int con_unify_unimap(struct vc_data *conp, struct uni_pagedict *p) ...@@ -499,18 +499,16 @@ static int con_unify_unimap(struct vc_data *conp, struct uni_pagedict *p)
static int static int
con_insert_unipair(struct uni_pagedict *p, u_short unicode, u_short fontpos) con_insert_unipair(struct uni_pagedict *p, u_short unicode, u_short fontpos)
{ {
int i, n; int n;
u16 **p1, *p2; u16 **p1, *p2;
n = UNI_DIR(unicode); n = UNI_DIR(unicode);
p1 = p->uni_pgdir[n]; p1 = p->uni_pgdir[n];
if (!p1) { if (!p1) {
p1 = p->uni_pgdir[n] = kmalloc_array(UNI_DIR_ROWS, p1 = p->uni_pgdir[n] = kcalloc(UNI_DIR_ROWS, sizeof(u16 *),
sizeof(u16 *), GFP_KERNEL); GFP_KERNEL);
if (!p1) if (!p1)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < UNI_DIR_ROWS; i++)
p1[i] = NULL;
} }
n = UNI_ROW(unicode); n = UNI_ROW(unicode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment