Re: [ovs-dev] [PATCH 3/4] ovsdb: Fix Clang's static analyzer 'func null dereference' warnings.
On 18 Oct 2023, at 12:56, Simon Horman wrote: > On Tue, Oct 17, 2023 at 03:49:48PM +0200, Eelco Chaudron wrote: >> Rather than crashing when a mod_double is requested, return >> `Operation not supported`. >> >> Signed-off-by: Eelco Chaudron > > Hi Eelco, > > is this a bug? If so could we have a Fixes tag and a description of how > a user might end up in such a predicament. If not, can we clearly state > that? This is all based on the clang report, did not dig into whether we can end up in this scenario with a user action. Will take a look and update the series. //Eelco ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH 3/4] ovsdb: Fix Clang's static analyzer 'func null dereference' warnings.
On Tue, Oct 17, 2023 at 03:49:48PM +0200, Eelco Chaudron wrote: > Rather than crashing when a mod_double is requested, return > `Operation not supported`. > > Signed-off-by: Eelco Chaudron Hi Eelco, is this a bug? If so could we have a Fixes tag and a description of how a user might end up in such a predicament. If not, can we clearly state that? ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH 3/4] ovsdb: Fix Clang's static analyzer 'func null dereference' warnings.
Rather than crashing when a mod_double is requested, return `Operation not supported`. Signed-off-by: Eelco Chaudron --- ovsdb/mutation.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ovsdb/mutation.c b/ovsdb/mutation.c index cbc71bc49..794560019 100644 --- a/ovsdb/mutation.c +++ b/ovsdb/mutation.c @@ -236,7 +236,8 @@ ovsdb_mutation_set_destroy(struct ovsdb_mutation_set *set) enum ovsdb_mutation_scalar_error { ME_OK, ME_DOM, -ME_RANGE +ME_RANGE, +ME_NOTSUP }; struct ovsdb_scalar_mutation { @@ -267,6 +268,9 @@ ovsdb_mutation_scalar_error(enum ovsdb_mutation_scalar_error error, "Result of \"%s\" operation is out of range.", ovsdb_mutator_to_string(mutator)); +case ME_NOTSUP: +return ovsdb_error(NULL, "Operation not supported."); + default: return OVSDB_BUG("unexpected error"); } @@ -514,6 +518,12 @@ div_double(double *x, double y) } } +static int +mod_double(double *x OVS_UNUSED, double y OVS_UNUSED) +{ +return ME_NOTSUP; +} + static const struct ovsdb_scalar_mutation add_mutation = { add_int, add_double, OVSDB_M_ADD }; @@ -531,5 +541,5 @@ static const struct ovsdb_scalar_mutation div_mutation = { }; static const struct ovsdb_scalar_mutation mod_mutation = { -mod_int, NULL, OVSDB_M_MOD +mod_int, mod_double, OVSDB_M_MOD }; ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev