mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 14:19:16 +00:00
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>
This commit is contained in:
parent
777e456852
commit
e1488513ab
1 changed files with 4 additions and 4 deletions
|
@ -33,16 +33,16 @@ static struct tty_audit_buf *tty_audit_buf_alloc(void)
|
||||||
{
|
{
|
||||||
struct tty_audit_buf *buf;
|
struct tty_audit_buf *buf;
|
||||||
|
|
||||||
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
|
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
buf->data = kmalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
|
buf->data = kmalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
|
||||||
if (!buf->data)
|
if (!buf->data)
|
||||||
goto err_buf;
|
goto err_buf;
|
||||||
|
|
||||||
mutex_init(&buf->mutex);
|
mutex_init(&buf->mutex);
|
||||||
buf->dev = MKDEV(0, 0);
|
|
||||||
buf->icanon = 0;
|
|
||||||
buf->valid = 0;
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
err_buf:
|
err_buf:
|
||||||
|
|
Loading…
Reference in a new issue