]> git.baikalelectronics.ru Git - kernel.git/commit
ice: Add check for kzalloc
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Thu, 8 Dec 2022 13:35:52 +0000 (21:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:27 +0000 (11:58 +0100)
commit84f959d3f32050213cec33e901ccab88f884d268
treea2464152f8b2bc9d38ab3c656c234e436cf97199
parenta2cf3182326ee1b5f449114c16b403d1ce8f48b0
ice: Add check for kzalloc

[ Upstream commit 40543b3d9d2c13227ecd3aa90a713c201d1d7f09 ]

Add the check for the return value of kzalloc in order to avoid
NULL pointer dereference.
Moreover, use the goto-label to share the clean code.

Fixes: 4a87d274321a ("ice: add write functionality for GNSS TTY")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ice/ice_gnss.c