netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: dcb: set error code on failures
@ 2016-12-03 13:49 Pan Bian
  2016-12-04  4:55 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2016-12-03 13:49 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: linux-kernel, Pan Bian

From: Pan Bian <bianpan2016@163.com>

In function dcbnl_cee_fill(), returns the value of variable err on
errors. However, on some error paths (e.g. nla put fails), its value may
be 0. It may be better to explicitly set a negative errno to variable
err before returning.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188881

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 net/dcb/dcbnl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 4f6c186..3202d75 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1353,6 +1353,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
 dcb_unlock:
 	spin_unlock_bh(&dcb_lock);
 nla_put_failure:
+	err = -EMSGSIZE;
 	return err;
 }
 
-- 
1.9.1

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

* Re: [PATCH 1/1] net: dcb: set error code on failures
  2016-12-03 13:49 [PATCH 1/1] net: dcb: set error code on failures Pan Bian
@ 2016-12-04  4:55 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-04  4:55 UTC (permalink / raw)
  To: bianpan201602; +Cc: netdev, linux-kernel, bianpan2016

From: Pan Bian <bianpan201602@163.com>
Date: Sat,  3 Dec 2016 21:49:08 +0800

> From: Pan Bian <bianpan2016@163.com>
> 
> In function dcbnl_cee_fill(), returns the value of variable err on
> errors. However, on some error paths (e.g. nla put fails), its value may
> be 0. It may be better to explicitly set a negative errno to variable
> err before returning.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188881
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Applied, thanks.

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

end of thread, other threads:[~2016-12-04  4:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-03 13:49 [PATCH 1/1] net: dcb: set error code on failures Pan Bian
2016-12-04  4:55 ` 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).