Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1535588 > unrolled thread

[PATCH 1/1] net: irda: set error code on failures

Started byPan Bian <bianpan201603@163.com>
First post2016-12-04 06:30 +0100
Last post2016-12-05 21:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] net: irda: set error code on failures Pan Bian <bianpan201603@163.com> - 2016-12-04 06:30 +0100
    Re: [PATCH 1/1] net: irda: set error code on failures David Miller <davem@davemloft.net> - 2016-12-05 21:00 +0100

#1535588 — [PATCH 1/1] net: irda: set error code on failures

FromPan Bian <bianpan201603@163.com>
Date2016-12-04 06:30 +0100
Subject[PATCH 1/1] net: irda: set error code on failures
Message-ID<sKxx7-32t-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1536367

FromDavid Miller <davem@davemloft.net>
Date2016-12-05 21:00 +0100
Message-ID<sL7AB-kR-11@gated-at.bofh.it>
In reply to#1535588
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web