Message ID | 20150804074927.GD10867@mwanda (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Kalle Valo |
Headers | show |
Hi Dan, > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > Sent: Tuesday, August 04, 2015 1:19 PM > To: Amitkumar Karwar > Cc: Nishant Sarmukadam; Kalle Valo; linux-wireless@vger.kernel.org; > kernel-janitors@vger.kernel.org > Subject: [patch] mwifiex: usb: return an error if kmalloc fails > > The current code returns success if kmalloc fails. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > > diff --git a/drivers/net/wireless/mwifiex/usb.c > b/drivers/net/wireless/mwifiex/usb.c > index fbad99c..f866d5d 100644 > --- a/drivers/net/wireless/mwifiex/usb.c > +++ b/drivers/net/wireless/mwifiex/usb.c > @@ -870,8 +870,10 @@ static int mwifiex_prog_fw_w_helper(struct > mwifiex_adapter *adapter, > > /* Allocate memory for transmit */ > fwdata = kzalloc(FW_DNLD_TX_BUF_SIZE, GFP_KERNEL); > - if (!fwdata) > + if (!fwdata) { > + ret = -ENOMEM; > goto fw_exit; > + } > > /* Allocate memory for receive */ > recv_buff = kzalloc(FW_DNLD_RX_BUF_SIZE, GFP_KERNEL); Acked-by: Amitkumar Karwar <akarwar@marvell.com> Regards, Amitkumar -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> The current code returns success if kmalloc fails. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > Acked-by: Amitkumar Karwar <akarwar@marvell.com> Thanks, applied to wireless-drivers-next.git. Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index fbad99c..f866d5d 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c @@ -870,8 +870,10 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, /* Allocate memory for transmit */ fwdata = kzalloc(FW_DNLD_TX_BUF_SIZE, GFP_KERNEL); - if (!fwdata) + if (!fwdata) { + ret = -ENOMEM; goto fw_exit; + } /* Allocate memory for receive */ recv_buff = kzalloc(FW_DNLD_RX_BUF_SIZE, GFP_KERNEL);
The current code returns success if kmalloc fails. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html