[ovs-dev] [PATCH] lib/odp: coverity null check in odp_execute_sample
tgraf at noironetworks.com
Wed Aug 27 08:50:07 UTC 2014
On 08/26/14 at 06:00pm, Madhu Challa wrote:
> call odp_execute_actions__ only if there are any subactions to prevent null
> pointer dereference in nl_attr_get().
> Signed-off-by: Madhu Challa <challa at noironetworks.com>
> lib/odp-execute.c | 3 +++
> 1 file changed, 3 insertions(+)
> diff --git a/lib/odp-execute.c b/lib/odp-execute.c
> index e1e9b57..607af03 100644
> --- a/lib/odp-execute.c
> +++ b/lib/odp-execute.c
> @@ -194,6 +194,9 @@ odp_execute_sample(void *dp, struct dpif_packet
> *packet, bool steal,
> + if (subactions == NULL)
> + return;
Or we call odp_execute_actions__() in the OVS_SAMPLE_ATTR_ACTIONS
case directly and avoid the checks in the fast path. OVS is controlling
the attribute ordering and we rely on it in a lot of other places.
A probability attribute after the sub actions should be considered a bug.
An OVS_NOT_REACHED() after the loop can handle the no sub actions case
with an assert without affecting the fast path.
More information about the dev