Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77b924d9 authored by Li RongQing's avatar Li RongQing Committed by Greg Kroah-Hartman
Browse files

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: default avatarLi RongQing <lirongqing@baidu.com>
Reviewed-by: default avatarWang Li <wangli39@baidu.com>
Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 69967638
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment