From a77ec45110fa34ab26cd3885b7faa0aadb4d5971 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 29 Jan 2016 09:45:35 +0100 Subject: [PATCH] ifcfg: make Coverity happy CID 59382 (#1 of 1): Dereference null return value (NULL_RETURNS) 10. dereference: Dereferencing a pointer that might be null value when calling strcmp. Not exactly true, since we ruled out the posibility earlier; but we could still get rid of a couple of strcmps. --- src/settings/plugins/ifcfg-rh/reader.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 6f20dc1111..d03fafef83 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -3148,8 +3148,7 @@ make_wpa_setting (shvarFile *ifcfg, g_free (allow_rsn); } - /* coverity[dereference] */ - if (!strcmp (value, "WPA-PSK")) { + if (wpa_psk) { NMSettingSecretFlags psk_flags; psk_flags = read_secret_flags (ifcfg, "WPA_PSK_FLAGS"); @@ -3169,7 +3168,7 @@ make_wpa_setting (shvarFile *ifcfg, g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", NULL); else g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", NULL); - } else if (!strcmp (value, "WPA-EAP") || !strcmp (value, "IEEE8021X")) { + } else if (wpa_eap || ieee8021x) { /* Adhoc mode is mutually exclusive with any 802.1x-based authentication */ if (adhoc) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,