Skip to content

Commit e148851

Browse files
Jiri Slabygregkh
authored andcommitted
tty_audit: use kzalloc() in tty_audit_buf_alloc()
tty_audit_buf_alloc() manually erases most of the entries after kmalloc(). So use kzalloc() and remove the manual sets to zero. That way, we are sure that we do not omit anything. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230621101611.10580-3-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 777e456 commit e148851

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/tty/tty_audit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ static struct tty_audit_buf *tty_audit_buf_alloc(void)
3333
{
3434
struct tty_audit_buf *buf;
3535

36-
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
36+
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
3737
if (!buf)
3838
goto err;
39+
3940
buf->data = kmalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
4041
if (!buf->data)
4142
goto err_buf;
43+
4244
mutex_init(&buf->mutex);
43-
buf->dev = MKDEV(0, 0);
44-
buf->icanon = 0;
45-
buf->valid = 0;
45+
4646
return buf;
4747

4848
err_buf:

0 commit comments

Comments
 (0)