From 3a919aee4424281cca765741fe8e4c881d535df2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 10 Feb 2010 11:09:40 -0800 Subject: [PATCH] flow: Fix null pointer dereference in flow_from_match(). Found by Clang (http://clang-analyzer.llvm.org). --- lib/flow.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/flow.c b/lib/flow.c index 7d4a1bd4d..bfbd54241 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -283,13 +283,14 @@ flow_from_match(flow_t *flow, uint32_t *wildcards, { if (wildcards) { *wildcards = ntohl(match->wildcards); - } - /* The datapath supports matching on an ARP's opcode and IP addresses, - * but OpenFlow does not. In case the controller hasn't, we need to - * set the appropriate wildcard bits so that we're externally - * OpenFlow-compliant. */ - if (match->dl_type == htons(ETH_TYPE_ARP)) { - *wildcards |= (OFPFW_NW_PROTO | OFPFW_NW_SRC_ALL | OFPFW_NW_DST_ALL); + + /* The datapath supports matching on an ARP's opcode and IP addresses, + * but OpenFlow does not. In case the controller hasn't, we need to + * set the appropriate wildcard bits so that we're externally + * OpenFlow-compliant. */ + if (match->dl_type == htons(ETH_TYPE_ARP)) { + *wildcards |= OFPFW_NW_PROTO | OFPFW_NW_SRC_ALL | OFPFW_NW_DST_ALL; + } } flow->nw_src = match->nw_src; -- 2.43.0