diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2015-01-10 01:18:53 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-25 12:17:57 -0500 |
commit | 69258c058d0a7e0a6433dae7e336c316d28129fc (patch) | |
tree | f7c6543b9fb98fbdcec6e5e8e6d7841739eecbe2 /tools | |
parent | 77ce247a8dbc587564dbfcb16fc6d09f6f85b31b (diff) |
Tools: hv: address compiler warnings for hv_kvp_daemon.c
This patch addresses two types of compiler warnings:
... warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
and
... warning: pointer targets in passing argument N of .kvp_.... differ in signedness [-Wpointer-sign]
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hv/hv_kvp_daemon.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index fe790090f328..408bb076a234 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c | |||
@@ -308,7 +308,7 @@ static int kvp_file_init(void) | |||
308 | return 0; | 308 | return 0; |
309 | } | 309 | } |
310 | 310 | ||
311 | static int kvp_key_delete(int pool, const char *key, int key_size) | 311 | static int kvp_key_delete(int pool, const __u8 *key, int key_size) |
312 | { | 312 | { |
313 | int i; | 313 | int i; |
314 | int j, k; | 314 | int j, k; |
@@ -351,8 +351,8 @@ static int kvp_key_delete(int pool, const char *key, int key_size) | |||
351 | return 1; | 351 | return 1; |
352 | } | 352 | } |
353 | 353 | ||
354 | static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const char *value, | 354 | static int kvp_key_add_or_modify(int pool, const __u8 *key, int key_size, |
355 | int value_size) | 355 | const __u8 *value, int value_size) |
356 | { | 356 | { |
357 | int i; | 357 | int i; |
358 | int num_records; | 358 | int num_records; |
@@ -405,7 +405,7 @@ static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const | |||
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
407 | 407 | ||
408 | static int kvp_get_value(int pool, const char *key, int key_size, char *value, | 408 | static int kvp_get_value(int pool, const __u8 *key, int key_size, __u8 *value, |
409 | int value_size) | 409 | int value_size) |
410 | { | 410 | { |
411 | int i; | 411 | int i; |
@@ -437,8 +437,8 @@ static int kvp_get_value(int pool, const char *key, int key_size, char *value, | |||
437 | return 1; | 437 | return 1; |
438 | } | 438 | } |
439 | 439 | ||
440 | static int kvp_pool_enumerate(int pool, int index, char *key, int key_size, | 440 | static int kvp_pool_enumerate(int pool, int index, __u8 *key, int key_size, |
441 | char *value, int value_size) | 441 | __u8 *value, int value_size) |
442 | { | 442 | { |
443 | struct kvp_record *record; | 443 | struct kvp_record *record; |
444 | 444 | ||
@@ -659,7 +659,7 @@ static char *kvp_if_name_to_mac(char *if_name) | |||
659 | char *p, *x; | 659 | char *p, *x; |
660 | char buf[256]; | 660 | char buf[256]; |
661 | char addr_file[256]; | 661 | char addr_file[256]; |
662 | int i; | 662 | unsigned int i; |
663 | char *mac_addr = NULL; | 663 | char *mac_addr = NULL; |
664 | 664 | ||
665 | snprintf(addr_file, sizeof(addr_file), "%s%s%s", "/sys/class/net/", | 665 | snprintf(addr_file, sizeof(addr_file), "%s%s%s", "/sys/class/net/", |
@@ -698,7 +698,7 @@ static char *kvp_mac_to_if_name(char *mac) | |||
698 | char buf[256]; | 698 | char buf[256]; |
699 | char *kvp_net_dir = "/sys/class/net/"; | 699 | char *kvp_net_dir = "/sys/class/net/"; |
700 | char dev_id[256]; | 700 | char dev_id[256]; |
701 | int i; | 701 | unsigned int i; |
702 | 702 | ||
703 | dir = opendir(kvp_net_dir); | 703 | dir = opendir(kvp_net_dir); |
704 | if (dir == NULL) | 704 | if (dir == NULL) |
@@ -748,7 +748,7 @@ static char *kvp_mac_to_if_name(char *mac) | |||
748 | 748 | ||
749 | 749 | ||
750 | static void kvp_process_ipconfig_file(char *cmd, | 750 | static void kvp_process_ipconfig_file(char *cmd, |
751 | char *config_buf, int len, | 751 | char *config_buf, unsigned int len, |
752 | int element_size, int offset) | 752 | int element_size, int offset) |
753 | { | 753 | { |
754 | char buf[256]; | 754 | char buf[256]; |
@@ -766,7 +766,7 @@ static void kvp_process_ipconfig_file(char *cmd, | |||
766 | if (offset == 0) | 766 | if (offset == 0) |
767 | memset(config_buf, 0, len); | 767 | memset(config_buf, 0, len); |
768 | while ((p = fgets(buf, sizeof(buf), file)) != NULL) { | 768 | while ((p = fgets(buf, sizeof(buf), file)) != NULL) { |
769 | if ((len - strlen(config_buf)) < (element_size + 1)) | 769 | if (len < strlen(config_buf) + element_size + 1) |
770 | break; | 770 | break; |
771 | 771 | ||
772 | x = strchr(p, '\n'); | 772 | x = strchr(p, '\n'); |
@@ -914,7 +914,7 @@ static int kvp_process_ip_address(void *addrp, | |||
914 | 914 | ||
915 | static int | 915 | static int |
916 | kvp_get_ip_info(int family, char *if_name, int op, | 916 | kvp_get_ip_info(int family, char *if_name, int op, |
917 | void *out_buffer, int length) | 917 | void *out_buffer, unsigned int length) |
918 | { | 918 | { |
919 | struct ifaddrs *ifap; | 919 | struct ifaddrs *ifap; |
920 | struct ifaddrs *curp; | 920 | struct ifaddrs *curp; |
@@ -1017,8 +1017,7 @@ kvp_get_ip_info(int family, char *if_name, int op, | |||
1017 | weight += hweight32(&w[i]); | 1017 | weight += hweight32(&w[i]); |
1018 | 1018 | ||
1019 | sprintf(cidr_mask, "/%d", weight); | 1019 | sprintf(cidr_mask, "/%d", weight); |
1020 | if ((length - sn_offset) < | 1020 | if (length < sn_offset + strlen(cidr_mask) + 1) |
1021 | (strlen(cidr_mask) + 1)) | ||
1022 | goto gather_ipaddr; | 1021 | goto gather_ipaddr; |
1023 | 1022 | ||
1024 | if (sn_offset == 0) | 1023 | if (sn_offset == 0) |