netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: irda: set error code on failures
@ 2016-12-04  5:27 Pan Bian
  2016-12-05 19:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2016-12-04  5:27 UTC (permalink / raw)
  To: Samuel Ortiz, netdev; +Cc: linux-kernel, Pan Bian

From: Pan Bian <bianpan2016@163.com>

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>
---
 drivers/net/irda/irda-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index a198946..8716b8c 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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] net: irda: set error code on failures
  2016-12-04  5:27 [PATCH 1/1] net: irda: set error code on failures Pan Bian
@ 2016-12-05 19:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-05 19:53 UTC (permalink / raw)
  To: bianpan201603; +Cc: samuel, netdev, linux-kernel, bianpan2016

From: Pan Bian <bianpan201603@163.com>
Date: Sun,  4 Dec 2016 13:27:40 +0800

> From: Pan Bian <bianpan2016@163.com>
> 
> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-05 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-04  5:27 [PATCH 1/1] net: irda: set error code on failures Pan Bian
2016-12-05 19:53 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).