mirror of https://gitee.com/openkylin/linux.git
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: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
87e5808d52
commit
d624613e42
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue