Message ID | 20240909045505.236657-2-mkp@redhat.com |
---|---|
State | Accepted, archived |
Commit | e48ba271f48ca06c1a57c7d8d8bddd5ffb6dca01 |
Delegated to: | Eelco Chaudron |
Headers | show |
Series | Address clang analyze warnings. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
On 9 Sep 2024, at 6:54, Mike Pattrick wrote: > The Clang analyzer has trouble detecting that functions can never return > null in certain conditions, this results in several false "Dereference of > null pointer" detections. > > This patch annotates functions that call ovsdb_error_valist() > unconditionally as non-null, as this function will either return a valid > pointer or call abort(). > > Signed-off-by: Mike Pattrick <mkp@redhat.com> Thanks for sending out the v3, the changes look good to me. Cheers, Eelco Acked-by: Eelco Chaudron <echaudro@redhat.com>
On Mon, Sep 09, 2024 at 12:54:58AM -0400, Mike Pattrick wrote: > The Clang analyzer has trouble detecting that functions can never return > null in certain conditions, this results in several false "Dereference of > null pointer" detections. > > This patch annotates functions that call ovsdb_error_valist() > unconditionally as non-null, as this function will either return a valid > pointer or call abort(). > > Signed-off-by: Mike Pattrick <mkp@redhat.com> Acked-by: Simon Horman <horms@ovn.org>
diff --git a/lib/ovsdb-error.h b/lib/ovsdb-error.h index 77a60e074..e91b6336a 100644 --- a/lib/ovsdb-error.h +++ b/lib/ovsdb-error.h @@ -22,14 +22,17 @@ struct json; struct ovsdb_error *ovsdb_error(const char *tag, const char *details, ...) OVS_PRINTF_FORMAT(2, 3) - OVS_WARN_UNUSED_RESULT; + OVS_WARN_UNUSED_RESULT + OVS_RETURNS_NONNULL; struct ovsdb_error *ovsdb_io_error(int error, const char *details, ...) OVS_PRINTF_FORMAT(2, 3) - OVS_WARN_UNUSED_RESULT; + OVS_WARN_UNUSED_RESULT + OVS_RETURNS_NONNULL; struct ovsdb_error *ovsdb_syntax_error(const struct json *, const char *tag, const char *details, ...) OVS_PRINTF_FORMAT(3, 4) - OVS_WARN_UNUSED_RESULT; + OVS_WARN_UNUSED_RESULT + OVS_RETURNS_NONNULL; struct ovsdb_error *ovsdb_wrap_error(struct ovsdb_error *error, const char *details, ...) @@ -39,11 +42,13 @@ struct ovsdb_error *ovsdb_internal_error(struct ovsdb_error *error, const char *file, int line, const char *details, ...) OVS_PRINTF_FORMAT(4, 5) - OVS_WARN_UNUSED_RESULT; + OVS_WARN_UNUSED_RESULT + OVS_RETURNS_NONNULL; struct ovsdb_error *ovsdb_perm_error(const char *details, ...) OVS_PRINTF_FORMAT(1, 2) - OVS_WARN_UNUSED_RESULT; + OVS_WARN_UNUSED_RESULT + OVS_RETURNS_NONNULL; /* Returns a pointer to an ovsdb_error that represents an internal error for * the current file name and line number with MSG as the associated message.