diff mbox

[ovs-dev] Fixes: 3f5b5f7b4115 ("db-ctl-base: Always support all tables in schema.")

Message ID f7th8yig6xy.fsf@redhat.com
State Not Applicable
Headers show

Commit Message

Aaron Conole July 11, 2017, 6:32 p.m. UTC
Hi ZhiPeng,

ZhiPeng Lu <lu.zhipeng@zte.com.cn> writes:

> This fixes an assertion failure in command "ovs-vsctl list netflow br0",
> if bridge br0 without any netflows.
> $ovs-vsctl list netflow br0
> ovs-vsctl: lib/ovsdb-idl.c:2407: assertion column_idx < class->n_columns failed 
> in ovsdb_idl_read()
> Aborted
>
> Get_row_by_id() shoudle return NULL if not find by ovsdb_idl_get_row_for_uuid().
>
> Signed-off-by: Zhipeng Lu <lu.zhipeng@zte.com.cn>
> ---

Would the following delta fit better?  I don't know about the
correctness of the original change, so I CC'd Alex Wang (the author
of the commit in question.)

---

Comments

Ben Pfaff July 14, 2017, 12:18 a.m. UTC | #1
On Tue, Jul 11, 2017 at 02:32:57PM -0400, Aaron Conole wrote:
> Hi ZhiPeng,
> 
> ZhiPeng Lu <lu.zhipeng@zte.com.cn> writes:
> 
> > This fixes an assertion failure in command "ovs-vsctl list netflow br0",
> > if bridge br0 without any netflows.
> > $ovs-vsctl list netflow br0
> > ovs-vsctl: lib/ovsdb-idl.c:2407: assertion column_idx < class->n_columns failed 
> > in ovsdb_idl_read()
> > Aborted
> >
> > Get_row_by_id() shoudle return NULL if not find by ovsdb_idl_get_row_for_uuid().
> >
> > Signed-off-by: Zhipeng Lu <lu.zhipeng@zte.com.cn>
> > ---
> 
> Would the following delta fit better?  I don't know about the
> correctness of the original change, so I CC'd Alex Wang (the author
> of the commit in question.)
> 
> ---
> 
> diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
> index 7839389..a1be462 100644
> --- a/lib/db-ctl-base.c
> +++ b/lib/db-ctl-base.c
> @@ -336,7 +336,7 @@ get_row_by_id(struct ctl_context *ctx,
>          return NULL;
>      }
>  
> -    const struct ovsdb_idl_row *final = referrer;
> +    const struct ovsdb_idl_row *final = NULL;
>      if (id->uuid_column) {
>          const struct ovsdb_datum *uuid;

Usually the "if (id->uuid_column)" test is false, and we want to return
'referrer' in that case, not NULL.

(This code is not perfectly clear.  My fault, probably.)
diff mbox

Patch

diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
index 7839389..a1be462 100644
--- a/lib/db-ctl-base.c
+++ b/lib/db-ctl-base.c
@@ -336,7 +336,7 @@  get_row_by_id(struct ctl_context *ctx,
         return NULL;
     }
 
-    const struct ovsdb_idl_row *final = referrer;
+    const struct ovsdb_idl_row *final = NULL;
     if (id->uuid_column) {
         const struct ovsdb_datum *uuid;