diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2023-02-12 21:07:31 +0100 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2023-02-19 16:08:28 +0100 |
commit | 19372d8528d25d9774c1c6ede2642bdf57ce3cc3 (patch) | |
tree | d7bdc939ff703af66c9b884d9f28dab1ce0bc2df /bonding.c | |
parent | ed65a00adc751d102c2041a4a9a32df9dad52b9e (diff) | |
download | netifd-19372d8528d25d9774c1c6ede2642bdf57ce3cc3.tar.gz |
netifd: Fix multiple -Wsign-compare warnings
This fixes warnings like this:
warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
Mostly this was an int compared to a size_t returned by ARRAY_SIZE().
The easiest fix is to count on the size_t type.
The ifindex is sometimes an unsigned int and sometimes a signed int in
the kernel interfaces. I think it normally fits into an unsigned 16 bit
value, so this should be fine. Do the one comparison where the
compiler complains as a long.
Casting the result of sizeof() to int should be safe. These values are
never out of range of int.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'bonding.c')
-rw-r--r-- | bonding.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -396,7 +396,7 @@ bonding_apply_settings(struct bonding_device *bdev, struct blob_attr **tb) if ((cur = tb[BOND_ATTR_POLICY]) != NULL) { const char *policy = blobmsg_get_string(cur); - int i; + size_t i; for (i = 0; i < ARRAY_SIZE(bonding_policy_str); i++) { if (strcmp(policy, bonding_policy_str[i]) != 0) |