Commit d624613e authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

cxgb4: Check for kvzalloc allocation failure

t4_prep_fw doesn't check for card_fw pointer before store the read data,
which could lead to a NULL pointer dereference if kvzalloc failed.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 87e5808d
......@@ -4140,6 +4140,10 @@ static int adap_init0(struct adapter *adap)
* card
*/
card_fw = kvzalloc(sizeof(*card_fw), GFP_KERNEL);
if (!card_fw) {
ret = -ENOMEM;
goto bye;
}
/* Get FW from from /lib/firmware/ */
ret = request_firmware(&fw, fw_info->fw_mod_name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment