From c1a14ef42f1decf308133a133aa1cd429093fdec Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 23 Jun 2015 21:12:29 +0300 Subject: [PATCH] Do not check unsigned size is less than zero The variables here are unsigned and as such, cannot have a negative value. Use == 0 instead of <= 0 to make this cleaner. Signed-off-by: Jouni Malinen --- wpa_supplicant/dbus/dbus_new_handlers.c | 2 +- wpa_supplicant/dbus/dbus_old_handlers.c | 2 +- wpa_supplicant/events.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index 2a7e2cf9b..1c04e9280 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -214,7 +214,7 @@ dbus_bool_t set_network_properties(struct wpa_supplicant *wpa_s, } else if (entry.type == DBUS_TYPE_STRING) { if (should_quote_opt(entry.key)) { size = os_strlen(entry.str_value); - if (size <= 0) + if (size == 0) goto error; size += 3; diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/dbus/dbus_old_handlers.c index 0ffa1befb..20442d6b4 100644 --- a/wpa_supplicant/dbus/dbus_old_handlers.c +++ b/wpa_supplicant/dbus/dbus_old_handlers.c @@ -884,7 +884,7 @@ DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message, if (should_quote_opt(entry.key)) { size = os_strlen(entry.str_value); /* Zero-length option check */ - if (size <= 0) + if (size == 0) goto error; size += 3; /* For quotes and terminator */ value = os_zalloc(size); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index f15a6a43c..601ddb3d3 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1685,7 +1685,7 @@ int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s) #else /* CONFIG_NO_SCAN_PROCESSING */ struct os_reltime now; - if (wpa_s->last_scan_res_used <= 0) + if (wpa_s->last_scan_res_used == 0) return -1; os_get_reltime(&now);