* [PATCH] rtnetlink: Fix error handling in do_setlink()
@ 2010-05-21 12:25 David Howells
2010-05-22 6:52 ` Chris Wright
0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2010-05-21 12:25 UTC (permalink / raw)
To: netdev; +Cc: David Howells, Chris Wright, David S. Miller
Commit c02db8c6290bb992442fec1407643c94cc414375:
Author: Chris Wright <chrisw@sous-sol.org>
Date: Sun May 16 01:05:45 2010 -0700
Subject: rtnetlink: make SR-IOV VF interface symmetric
adds broken error handling to do_setlink() in net/core/rtnetlink.c. The
problem is the following chunk of code:
if (tb[IFLA_VFINFO_LIST]) {
struct nlattr *attr;
int rem;
nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) {
if (nla_type(attr) != IFLA_VF_INFO)
----> goto errout;
err = do_setvfinfo(dev, attr);
if (err < 0)
goto errout;
modified = 1;
}
}
which can get to errout without setting err, resulting in the following error:
net/core/rtnetlink.c: In function 'do_setlink':
net/core/rtnetlink.c:904: warning: 'err' may be used uninitialized in this function
Change the code to return -EINVAL in this case. Note that this might not be
the appropriate error though.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Chris Wright <chrisw@sous-sol.org>
cc: David S. Miller <davem@davemloft.net>
---
net/core/rtnetlink.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 31e85d3..56b4157 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1030,8 +1030,10 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
struct nlattr *attr;
int rem;
nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) {
- if (nla_type(attr) != IFLA_VF_INFO)
+ if (nla_type(attr) != IFLA_VF_INFO) {
+ err = -EINVAL;
goto errout;
+ }
err = do_setvfinfo(dev, attr);
if (err < 0)
goto errout;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rtnetlink: Fix error handling in do_setlink()
2010-05-21 12:25 [PATCH] rtnetlink: Fix error handling in do_setlink() David Howells
@ 2010-05-22 6:52 ` Chris Wright
2010-05-24 6:12 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wright @ 2010-05-22 6:52 UTC (permalink / raw)
To: David Howells; +Cc: netdev, Chris Wright, David S. Miller
* David Howells (dhowells@redhat.com) wrote:
> Commit c02db8c6290bb992442fec1407643c94cc414375:
>
> Author: Chris Wright <chrisw@sous-sol.org>
> Date: Sun May 16 01:05:45 2010 -0700
> Subject: rtnetlink: make SR-IOV VF interface symmetric
>
> adds broken error handling to do_setlink() in net/core/rtnetlink.c. The
> problem is the following chunk of code:
>
> if (tb[IFLA_VFINFO_LIST]) {
> struct nlattr *attr;
> int rem;
> nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) {
> if (nla_type(attr) != IFLA_VF_INFO)
> ----> goto errout;
> err = do_setvfinfo(dev, attr);
> if (err < 0)
> goto errout;
> modified = 1;
> }
> }
>
> which can get to errout without setting err, resulting in the following error:
>
> net/core/rtnetlink.c: In function 'do_setlink':
> net/core/rtnetlink.c:904: warning: 'err' may be used uninitialized in this function
>
> Change the code to return -EINVAL in this case. Note that this might not be
> the appropriate error though.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Thank you David, that's correct. I have some other pending changes
here, so I don't mind collecting them together.
thanks,
-chris
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtnetlink: Fix error handling in do_setlink()
2010-05-22 6:52 ` Chris Wright
@ 2010-05-24 6:12 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-05-24 6:12 UTC (permalink / raw)
To: chrisw; +Cc: dhowells, netdev
From: Chris Wright <chrisw@sous-sol.org>
Date: Fri, 21 May 2010 23:52:12 -0700
> * David Howells (dhowells@redhat.com) wrote:
>> Commit c02db8c6290bb992442fec1407643c94cc414375:
>>
>> Author: Chris Wright <chrisw@sous-sol.org>
>> Date: Sun May 16 01:05:45 2010 -0700
>> Subject: rtnetlink: make SR-IOV VF interface symmetric
>>
>> adds broken error handling to do_setlink() in net/core/rtnetlink.c. The
>> problem is the following chunk of code:
>>
>> if (tb[IFLA_VFINFO_LIST]) {
>> struct nlattr *attr;
>> int rem;
>> nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) {
>> if (nla_type(attr) != IFLA_VF_INFO)
>> ----> goto errout;
>> err = do_setvfinfo(dev, attr);
>> if (err < 0)
>> goto errout;
>> modified = 1;
>> }
>> }
>>
>> which can get to errout without setting err, resulting in the following error:
>>
>> net/core/rtnetlink.c: In function 'do_setlink':
>> net/core/rtnetlink.c:904: warning: 'err' may be used uninitialized in this function
>>
>> Change the code to return -EINVAL in this case. Note that this might not be
>> the appropriate error though.
>>
>> Signed-off-by: David Howells <dhowells@redhat.com>
>
> Acked-by: Chris Wright <chrisw@sous-sol.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-24 6:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 12:25 [PATCH] rtnetlink: Fix error handling in do_setlink() David Howells
2010-05-22 6:52 ` Chris Wright
2010-05-24 6:12 ` 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).