[ovs-dev] [PATCH] ofp-print: Fix redundant expression.

Joe Stringer joestringer at nicira.com
Wed Aug 5 20:31:25 UTC 2015


'features' is always a valid pointer to something on the stack, so
checking (!features || ...) is the same as checking (false || ...).
Simplify the expression.

Found by MIT STACK undefined behaviour checker.

Signed-off-by: Joe Stringer <joestringer at nicira.com>
---
 lib/ofp-print.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index b8088f3..6e32d4d 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -2754,7 +2754,7 @@ ofp_print_table_features(struct ds *s,
     bool same_stats = prev_stats && table_stats_equal(stats, prev_stats);
     bool same_features = prev_features && table_features_equal(features,
                                                                prev_features);
-    if ((!stats || same_stats) && (!features || same_features)) {
+    if ((!stats || same_stats) && same_features) {
         ds_put_cstr(s, " ditto");
         return;
     }
-- 
2.1.4




More information about the dev mailing list