Message ID | 20210204090230.1794169-1-snovitoll@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net/qrtr: replaced useless kzalloc with kmalloc in qrtr_tun_write_iter() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessing tree name failed - patch did not apply |
On Thu, 4 Feb 2021 15:02:30 +0600 Sabyrzhan Tasbolatov wrote: > Replaced kzalloc() with kmalloc(), there is no need for zeroed-out > memory for simple void *kbuf. There is no need for zeroed-out memory because it's immediately overwritten by copy_from_iter... > >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; >
On Thu, 4 Feb 2021 10:51:59 -0800 Jakub Kicinski wrote: > On Thu, 4 Feb 2021 15:02:30 +0600 Sabyrzhan Tasbolatov wrote: > > Replaced kzalloc() with kmalloc(), there is no need for zeroed-out > > memory for simple void *kbuf. > > There is no need for zeroed-out memory because it's immediately > overwritten by copy_from_iter... Also if you don't mind please wait a week until the fixes get merged back into net-next and then repost. Otherwise this patch will not apply cleanly. (Fixes are merged into a different tree than cleanups) > > 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; > > >
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;