diff options
| author | Li RongQing <lirongqing@baidu.com> | 2019-03-29 09:18:02 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-27 09:33:55 +0200 |
| commit | 8ed95ff262aa8ed37df94b59b84eee93a0b9e133 (patch) | |
| tree | 500b6dee563e0398a5d3e85af0235620078b799f /include/linux/stackprotector.h | |
| parent | 0ede14314f6d9e6a172eb4c4b6b9fe5477aa70bc (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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/stackprotector.h')
0 files changed, 0 insertions, 0 deletions
