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

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
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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,