From: David Miller <davem@davemloft.net>
To: lirongqing@baidu.com
Cc: netdev@vger.kernel.org, mkubecek@suse.cz
Subject: Re: [PATCH][v2] net: ethtool: not call vzalloc for zero sized memory request
Date: Fri, 29 Mar 2019 13:42:40 -0700 (PDT) [thread overview]
Message-ID: <20190329.134240.2198417000673971691.davem@davemloft.net> (raw)
In-Reply-To: <1553822282-6658-1-git-send-email-lirongqing@baidu.com>
From: Li RongQing <lirongqing@baidu.com>
Date: Fri, 29 Mar 2019 09:18:02 +0800
> NULL or ZERO_SIZE_PTR will be returned for zero sized memory
> request, and derefencing them will lead to a segfault
>
> so it is unnecessory to call vzalloc for zero sized memory
> request and not call functions which maybe derefence the
> NULL allocated memory
>
> this also fixes a possible memory leak if phy_ethtool_get_stats
> returns error, memory should be freed before exit
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> Reviewed-by: Wang Li <wangli39@baidu.com>
> ---
> v1->v2: not call get_ethtool_stats if n_stats is 0
Applied and queued up for -stable, thanks.
prev parent reply other threads:[~2019-04-01 18:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 1:18 [PATCH][v2] net: ethtool: not call vzalloc for zero sized memory request Li RongQing
2019-03-29 9:29 ` Michal Kubecek
2019-03-29 9:35 ` 答复: " Li,Rongqing
2019-03-29 10:06 ` Michal Kubecek
2019-03-29 20:42 ` David Miller [this message]
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=20190329.134240.2198417000673971691.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=lirongqing@baidu.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/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).