Message ID | 169807095933.1031379.17066604761406675293.stgit@ebuild |
---|---|
State | Accepted |
Delegated to: | Simon Horman |
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 Mon, Oct 23, 2023 at 04:22:39PM +0200, Eelco Chaudron wrote: > In the existing code, there is no existing path that would result > in a crash. Therefore, this code is currently implemented to > satisfy Clang's requirements. Nevertheless, it serves the > additional purpose of preventing issues with potential new use > cases of the ovsdb_mutation_set_execute() API. > > Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Hi Eelco, Thanks for addressing my concerns regarding the patch description in v1. This looks good to me. Acked-by: Simon Horman <horms@ovn.org>
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 };
In the existing code, there is no existing path that would result in a crash. Therefore, this code is currently implemented to satisfy Clang's requirements. Nevertheless, it serves the additional purpose of preventing issues with potential new use cases of the ovsdb_mutation_set_execute() API. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> --- ovsdb/mutation.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)