diff options
| author | Li RongQing <lirongqing@baidu.com> | 2019-03-29 09:18:02 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-17 08:38:40 +0200 |
| commit | 80c205813d3f5d7a912c73487d1ee6d76a696af1 (patch) | |
| tree | b2163a5b9b3b6a42181fa30bff22255eac69525d /include/linux/mbcache.h | |
| parent | b7b058315577de56aff6bdcd836c8ec60cdb25a4 (diff) | |
net: ethtool: not call vzalloc for zero sized memory request
[ Upstream commit 3d8830266ffc28c16032b859e38a0252e014b631 ]
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>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux/mbcache.h')
0 files changed, 0 insertions, 0 deletions
