[ovs-dev] [PATCH] datapath: Fix uninitialized variable warning.
Jesse Gross
jesse at nicira.com
Fri Oct 21 22:56:33 UTC 2011
On Fri, Oct 21, 2011 at 3:46 PM, Pravin Shelar <pshelar at nicira.com> wrote:
> On Fri, Oct 21, 2011 at 3:26 PM, Jesse Gross <jesse at nicira.com> wrote:
>> Commit 4edb9ae90e4092f5f56b9d914d2b88783c49860d "datapath: Refactor
>> actions in terms of match fields." introduced a spurious warning
>> because the compiler thinks a value might not have been assigned to
>> 'err'. In practice this can't happen because we've already validated
>> the actions.
>>
>> CC: Pravin B Shelar <pshelar at nicira.com>
>> Signed-off-by: Jesse Gross <jesse at nicira.com>
>> ---
>> datapath/actions.c | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/datapath/actions.c b/datapath/actions.c
>> index 70f48ea..8ca243d 100644
>> --- a/datapath/actions.c
>> +++ b/datapath/actions.c
>> @@ -311,12 +311,11 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
>> static int execute_set_action(struct sk_buff *skb,
>> const struct nlattr *nested_attr)
>> {
>> - int err;
>> + int err = 0;
>>
>> switch (nla_type(nested_attr)) {
>> case OVS_KEY_ATTR_TUN_ID:
>> OVS_CB(skb)->tun_id = nla_get_be64(nested_attr);
>> - err = 0;
>> break;
>>
>> case OVS_KEY_ATTR_ETHERNET:
>> @@ -335,6 +334,7 @@ static int execute_set_action(struct sk_buff *skb,
>> err = set_udp_port(skb, nla_data(nested_attr));
>> break;
>> }
>> +
>> return err;
>> }
>>
>> @@ -396,8 +396,8 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
>> case OVS_ACTION_ATTR_SAMPLE:
>> err = sample(dp, skb, a);
>> break;
>> -
>> }
>> +
>> if (unlikely(err)) {
>> kfree_skb(skb);
>> return err;
>> --
> looks good.
>
> Acked-by: Pravin B Shelar <pshelar at nicira.com>
Thanks, I pushed it.
More information about the dev
mailing list