libteam: check opt_id.name for null

Coverity error:
CID 1031792 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)7. var_deref_model: Passing "&opt_id" to function "find_option(struct team_handle *, struct team_option_id *, bool)", which dereferences null "opt_id.name"

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
libteam: always add newly created option to option list

Coverity error:
CID 1031790 (#1 of 1): Resource leak (RESOURCE_LEAK)5. leaked_storage:
Variable "option" going out of scope leaks the storage it points to.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: fix possible memory leak in teamd_set_hwaddr

Coverity error:
CID 1031777 (#1 of 1): Resource leak (RESOURCE_LEAK)5. leaked_storage: Variable "hwaddr" going out of scope leaks the storage it points to.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamnl: fix possible memory leak in run_cmd_getoption()

Coverity error:
CID 1031771 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable "buf" going out of scope leaks the storage it points to.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: null-terminate string returned from readlink in teamd_sriov_physfn_addr()

Coverity error:
CID 1031769 (#1 of 1): String not null terminated (STRING_NULL)2. string_null_argument: Function "readlink(char const * restrict, char * restrict, size_t)" does not terminate string "*link".

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
libteam: ifinfo: fix possible overrun during srtcpy

Coverity error:
CID 1031768 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)3. fixed_size_dest: You might overrun the 16 byte fixed-size string "ifinfo->ifname" by copying "ifname" without checking the length.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: lacp: fix corner-case initialization of prio

Coverity error:
CID 1031767 (#1 of 1): Uninitialized scalar variable (UNINIT)4. uninit_use_in_call: Using uninitialized value "prio_info1.port" when calling "get_lacp_port_prio_info(struct lacp_port *, struct lacpdu_info *)".

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: fix use after free while flushing the port list

Coverity error:
CID 1031765 (#1 of 1): Read from pointer after free (USE_AFTER_FREE)5. deref_after_free: Dereferencing freed pointer "port".

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: fix use after free in teamd_loop_callback_del()

Coverity error:
CID 1031764 (#1 of 1): Use after free (USE_AFTER_FREE)5. pass_freed_arg: Passing freed pointer "lcb" as an argument to function "get_lcb_multi(struct teamd_context *, char const *, void *, struct teamd_loop_callback *)".

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: lacp: fix use after free in lacp_port_aggregator_select_work()

Coverity error:
CID 1031763 (#1 of 1): Read from pointer after free (USE_AFTER_FREE)2. deref_after_free: Dereferencing freed pointer "info".

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: dbus: call va_end on error path in dbus_op_get_args()

Coverity error:
CID 1031762 (#3 of 3): Missing varargs init or cleanup (VARARGS)17. missing_va_end: va_end was not called for "ap".

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
teamd: usock: call va_end on error path in usock_op_get_args()

Coverity error:
CID 1031761 (#2 of 2): Missing varargs init or cleanup (VARARGS)14. missing_va_end: va_end was not called for "ap".

Signed-off-by: Jiri Pirko <jiri@resnulli.us>