Re: [ovs-dev] [PATCH 3/5] dpctl: Fix Clang's static analyzer 'garbage value' warnings.

2024-05-17 Thread Ilya Maximets
On 5/16/24 21:36, Mike Pattrick wrote:
> Clang's static analyzer will complain about an uninitialized value
> because we weren't setting a value for ufid_generated in all code paths.
> 
> Now we initialize this on declaration.
> 
> Signed-off-by: Mike Pattrick 
> ---

Same comments for the subject line.
Also needs a Fixes tag.

>  lib/dpctl.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/dpctl.c b/lib/dpctl.c
> index 3c555a559..9c287d060 100644
> --- a/lib/dpctl.c
> +++ b/lib/dpctl.c
> @@ -1366,12 +1366,11 @@ dpctl_del_flow_dpif(struct dpif *dpif, const char 
> *key_s,
>  struct ofpbuf mask; /* To be ignored. */
>  
>  ovs_u128 ufid;
> -bool ufid_generated;
> -bool ufid_present;
> +bool ufid_generated = false;
> +bool ufid_present = false;

Maybe move these above the 'ufid' for the sake of a reverse x-mass.
And move the 'ufid' below the port names.

>  struct simap port_names;
>  int n, error;
>  
> -ufid_present = false;
>  n = odp_ufid_from_string(key_s, );
>  if (n < 0) {
>  dpctl_error(dpctl_p, -n, "parsing flow ufid");

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 3/5] dpctl: Fix Clang's static analyzer 'garbage value' warnings.

2024-05-16 Thread Mike Pattrick
Clang's static analyzer will complain about an uninitialized value
because we weren't setting a value for ufid_generated in all code paths.

Now we initialize this on declaration.

Signed-off-by: Mike Pattrick 
---
 lib/dpctl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/dpctl.c b/lib/dpctl.c
index 3c555a559..9c287d060 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -1366,12 +1366,11 @@ dpctl_del_flow_dpif(struct dpif *dpif, const char 
*key_s,
 struct ofpbuf mask; /* To be ignored. */
 
 ovs_u128 ufid;
-bool ufid_generated;
-bool ufid_present;
+bool ufid_generated = false;
+bool ufid_present = false;
 struct simap port_names;
 int n, error;
 
-ufid_present = false;
 n = odp_ufid_from_string(key_s, );
 if (n < 0) {
 dpctl_error(dpctl_p, -n, "parsing flow ufid");
-- 
2.39.3

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev