[ovs-dev] [PATCH v2] lib/classifier: Fix use of uninitialized memory.

Ben Pfaff blp at nicira.com
Wed Jun 11 21:46:03 UTC 2014


On Mon, Jun 09, 2014 at 03:06:22PM -0700, Jarno Rajahalme wrote:
> When reaching the end of a prefix trie, we checked one bit off the end
> to the intended data.  However, since the trie node in that case has
> NULLs for both edge links, this did not result in incorrect
> functionality.
> 
> Found via check-valgrind.
> 
> Reported-by: Ben Pfaff <blp at nicira.com>
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> ---
> v2: Clarify trie_lookup_value() by returning from the case when ofs
> >= n_bits.

I think that the only behavioral change here is:
+        if (ofs >= n_bits) {
+            *checkbits = n_bits; /* Full prefix. */
+            return match_len;
+        }
and updating the callers, which seems good.

Otherwise, I see two stylistic changes:

        1. s/plen/ofs/.  OK.

        2. Change "for" to "while".  This one is a little puzzling
           because I don't see a need for it.

I'd be tempted to put the behavioral changes in a patch by themselves
(to make it really obvious what's changing), and the stylistic changes
in another, but I'll leave it up to you.

Acked-by: Ben Pfaff <blp at nicira.com>



More information about the dev mailing list