diff options
author | 2016-12-04 13:27:40 +0800 | |
---|---|---|
committer | 2016-12-05 14:53:08 -0500 | |
commit | 8ad3ba934587c8ecbfee13331d859a7849afdfbb (patch) | |
tree | 4ec7e0aef86a11e387e7242836f40dfec5063da0 /drivers/net | |
parent | net: caif: remove ineffective check (diff) | |
download | linux-8ad3ba934587c8ecbfee13331d859a7849afdfbb.tar.gz linux-8ad3ba934587c8ecbfee13331d859a7849afdfbb.tar.bz2 linux-8ad3ba934587c8ecbfee13331d859a7849afdfbb.zip |
net: irda: set error code on failures
When the calls to kzalloc() fail, the value of return variable ret may
be 0. 0 means success in this context. This patch fixes the bug,
assigning "-ENOMEM" to ret before calling kzalloc().
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188971
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/irda/irda-usb.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index a198946bc54f..8716b8c07feb 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1723,6 +1723,7 @@ static int irda_usb_probe(struct usb_interface *intf, /* Don't change this buffer size and allocation without doing * some heavy and complete testing. Don't ask why :-( * Jean II */ + ret = -ENOMEM; self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); if (!self->speed_buff) goto err_out_3; |