Skip to content

Commit 4ff12d8

Browse files
Haoxiang Lianguy11
authored andcommitted
ice: Fix a null pointer dereference in ice_copy_and_init_pkg()
Add check for the return value of devm_kmemdup() to prevent potential null pointer dereference. Fixes: c764881 ("ice: Implement Dynamic Device Personalization (DDP) download") Cc: [email protected] Signed-off-by: Haoxiang Li <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Reviewed-by: Aleksandr Loktionov <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Rinitha S <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 5a0df02 commit 4ff12d8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/intel/ice/ice_ddp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,8 @@ enum ice_ddp_state ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf,
23012301
return ICE_DDP_PKG_ERR;
23022302

23032303
buf_copy = devm_kmemdup(ice_hw_to_dev(hw), buf, len, GFP_KERNEL);
2304+
if (!buf_copy)
2305+
return ICE_DDP_PKG_ERR;
23042306

23052307
state = ice_init_pkg(hw, buf_copy, len);
23062308
if (!ice_is_init_pkg_successful(state)) {

0 commit comments

Comments
 (0)