[ovs-dev] [PATCH ovn] ovn-northd: Fix use of uninitialized variables.
Dumitru Ceara
dceara at redhat.com
Fri Feb 21 12:02:01 UTC 2020
On 2/21/20 12:59 PM, Dumitru Ceara wrote:
> Calls to ip_address_and_port_from_lb_key() could fail parsing the 'key'
> argument and would return without setting *ip_address. The code in
> ovn_lb_create() was passing an unitialized 'backend_ip' pointer and
> using it unconditionally afterwards.
>
> With CFLAGS="-O3" gcc reports this issue too:
> $ ./configure CFLAGS="-O3" --enable-Werror [...]
> $ make
> [...]
> northd/ovn-northd.c: In function ‘ovnnb_db_run.isra.65’:
> northd/ovn-northd.c:3116:14: error: ‘backend_port’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> uint32_t hash = service_port;
> ^
> northd/ovn-northd.c:3207:22: note: ‘backend_port’ was declared here
> uint16_t backend_port;
> ^
> In file included from northd/ovn-northd.c:27:0:
> /home/dceara/git-repos/ovs/lib/hash.h:342:5: error: ‘backend_ip’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> return hash_bytes(s, strlen(s), basis);
> ^
> northd/ovn-northd.c:3206:19: note: ‘backend_ip’ was declared here
> char *backend_ip;
>
> Fix ip_address_and_port_from_lb_key() and make it return true if parsing
> was successful.
>
> Signed-off-by: Dumitru Ceara <dceara at redhat.com>
> ---
> northd/ovn-northd.c | 37 +++++++++++++++++++------------------
> 1 file changed, 19 insertions(+), 18 deletions(-)
>
Hi,
If possible, please backport this to branch 20.03 too.
Thanks,
Dumitru
More information about the dev
mailing list