Message ID | 169755058825.686004.314604590768129733.stgit@ebuild |
---|---|
State | Changes Requested |
Headers | show |
Series | Fix some of Clang's static analyzer warnings. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | success | test: success |
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 <echaudro@redhat.com> 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?
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 <echaudro@redhat.com> > > 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
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 };
Rather than crashing when a mod_double is requested, return `Operation not supported`. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> --- ovsdb/mutation.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)