linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
To: kuba@kernel.org
Cc: davem@davemloft.net, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, snovitoll@gmail.com,
	syzbot+c2a7e5c5211605a90865@syzkaller.appspotmail.com
Subject: [PATCH] net/qrtr: replaced useless kzalloc with kmalloc in qrtr_tun_write_iter()
Date: Thu,  4 Feb 2021 15:02:30 +0600	[thread overview]
Message-ID: <20210204090230.1794169-1-snovitoll@gmail.com> (raw)
In-Reply-To: <20210203162846.56a90288@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

Replaced kzalloc() with kmalloc(), there is no need for zeroed-out
memory for simple void *kbuf.

>For potential, separate clean up - this is followed 
>by copy_from_iter_full(len) kzalloc() can probably 
>be replaced by kmalloc()?
>
>>  	if (!kbuf)
>>  		return -ENOMEM;

Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
---
 net/qrtr/tun.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/qrtr/tun.c b/net/qrtr/tun.c
index b238c40a9984..9b607c7614de 100644
--- a/net/qrtr/tun.c
+++ b/net/qrtr/tun.c
@@ -86,7 +86,7 @@ static ssize_t qrtr_tun_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	if (len > KMALLOC_MAX_SIZE)
 		return -ENOMEM;
 
-	kbuf = kzalloc(len, GFP_KERNEL);
+	kbuf = kmalloc(len, GFP_KERNEL);
 	if (!kbuf)
 		return -ENOMEM;
 
-- 
2.25.1


  reply	other threads:[~2021-02-04  9:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  9:20 [PATCH] net/qrtr: restrict user-controlled length in qrtr_tun_write_iter() Sabyrzhan Tasbolatov
2021-02-04  0:28 ` Jakub Kicinski
2021-02-04  9:02   ` Sabyrzhan Tasbolatov [this message]
2021-02-04 18:51     ` [PATCH] net/qrtr: replaced useless kzalloc with kmalloc " Jakub Kicinski
2021-02-04 18:53       ` Jakub Kicinski
2021-02-04  0:40 ` [PATCH] net/qrtr: restrict user-controlled length " patchwork-bot+netdevbpf
2021-02-12 11:51 ` Eric Dumazet
2021-02-21 12:39   ` [PATCH] net/qrtr: restrict " Sabyrzhan Tasbolatov
2021-02-22  8:45     ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210204090230.1794169-1-snovitoll@gmail.com \
    --to=snovitoll@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+c2a7e5c5211605a90865@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).