diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-10-04 09:41:20 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-10-07 08:37:59 +0200 |
commit | 98e826e9933f1c8405587c638a53fc2ab984801a (patch) | |
tree | decbb00b85dd2aefb57cfb7be86ebf1f6ad14792 | |
parent | d0f85092b9af18d4fc26b6ec733f825739e956a0 (diff) | |
download | NetworkManager-bg/covscan.tar.gz |
libnm-core: fix int comparisons in team settingbg/covscan
These conditions are always false.
-rw-r--r-- | libnm-core/nm-setting-team.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c index c1389d042d..f50fae0681 100644 --- a/libnm-core/nm-setting-team.c +++ b/libnm-core/nm-setting-team.c @@ -125,9 +125,11 @@ nm_team_link_watcher_new_ethtool (int delay_up, NMTeamLinkWatcher *watcher; const char *val_fail = NULL; - if (delay_up < 0 || delay_up > G_MAXINT32) + G_STATIC_ASSERT_EXPR (sizeof (int) == sizeof (gint32)); + + if (delay_up < 0) val_fail = "delay-up"; - if (delay_down < 0 || delay_down > G_MAXINT32) + if (delay_down < 0) val_fail = "delay-down"; if (val_fail) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED, @@ -182,11 +184,13 @@ nm_team_link_watcher_new_nsna_ping (int init_wait, return NULL; } - if (init_wait < 0 || init_wait > G_MAXINT32) + G_STATIC_ASSERT_EXPR (sizeof (int) == sizeof (gint32)); + + if (init_wait < 0) val_fail = "init-wait"; - if (interval < 0 || interval > G_MAXINT32) + if (interval < 0) val_fail = "interval"; - if (missed_max < 0 || missed_max > G_MAXINT32) + if (missed_max < 0) val_fail = "missed-max"; if (val_fail) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED, @@ -255,11 +259,13 @@ nm_team_link_watcher_new_arp_ping (int init_wait, return NULL; } - if (init_wait < 0 || init_wait > G_MAXINT32) + G_STATIC_ASSERT_EXPR (sizeof (int) == sizeof (gint32)); + + if (init_wait < 0) val_fail = "init-wait"; - if (interval < 0 || interval > G_MAXINT32) + if (interval < 0) val_fail = "interval"; - if (missed_max < 0 || missed_max > G_MAXINT32) + if (missed_max < 0) val_fail = "missed-max"; if (val_fail) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED, |