diff options
author | Michal Kubecek <mkubecek@suse.cz> | 2023-05-08 00:22:23 +0200 |
---|---|---|
committer | Michal Kubecek <mkubecek@suse.cz> | 2023-05-08 00:22:23 +0200 |
commit | ca66f668900de668d2f27f9ba3a3c4ed549c8795 (patch) | |
tree | 42379133687a583c3dbe218fde2043f46c7ed6d4 | |
parent | 3d1f1c1e5070ce37190ada00fdf0440523020780 (diff) | |
parent | 7de97fb998689dfae18b045d5008af7cd932648e (diff) | |
download | ethtool-ca66f668900de668d2f27f9ba3a3c4ed549c8795.tar.gz |
Merge tag 'review/fanalyze-fixes-p2'
Nicolas Vinton:
This patch series provides updates to correct issues found by gcc -fanalyze. The
issues were found by specifying the following flags when building:
CFLAGS="-march=native -O2 -pipe -fanalyzer -Werror=analyzer-va-arg-type-mismatch
-Werror=analyzer-va-list-exhausted -Werror=analyzer-va-list-leak
-Werror=analyzer-va-list-use-after-va-end"
CXXCFLAGS="-march=native -O2 -pipe -fanalyzer
-Werror=analyzer-va-arg-type-mismatch
-Werror=analyzer-va-list-exhausted
-Werror=analyzer-va-list-leak
-Werror=analyzer-va-list-use-after-va-end"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
GCC version is gcc (Gentoo 13.1.0-r1 p1) 13.1.0
-rw-r--r-- | netlink/features.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/netlink/features.c b/netlink/features.c index a4dae8f..5711ff4 100644 --- a/netlink/features.c +++ b/netlink/features.c @@ -266,7 +266,7 @@ int nl_gfeatures(struct cmd_context *ctx) struct sfeatures_context { bool nothing_changed; - uint32_t req_mask[0]; + uint32_t req_mask[]; }; static int find_feature(const char *name, @@ -534,24 +534,36 @@ int nl_sfeatures(struct cmd_context *ctx) nlctx->devname = ctx->devname; ret = msg_init(nlctx, msgbuff, ETHTOOL_MSG_FEATURES_SET, NLM_F_REQUEST | NLM_F_ACK); - if (ret < 0) + if (ret < 0) { + free(sfctx); return 2; + } if (ethnla_fill_header(msgbuff, ETHTOOL_A_FEATURES_HEADER, ctx->devname, - ETHTOOL_FLAG_COMPACT_BITSETS)) + ETHTOOL_FLAG_COMPACT_BITSETS)) { + free(sfctx); return -EMSGSIZE; + } ret = fill_sfeatures_bitmap(nlctx, feature_names); - if (ret < 0) + if (ret < 0) { + free(sfctx); return ret; + } ret = nlsock_sendmsg(nlsk, NULL); - if (ret < 0) + if (ret < 0) { + free(sfctx); return 92; + } ret = nlsock_process_reply(nlsk, sfeatures_reply_cb, nlctx); if (sfctx->nothing_changed) { fprintf(stderr, "Could not change any device features\n"); + free(sfctx); return nlctx->exit_code ?: 1; } - if (ret == 0) + if (ret == 0) { + free(sfctx); return 0; + } + free(sfctx); return nlctx->exit_code ?: 92; } |