Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com
Subject: [PATCH net 3/7] ipvs: use explicitly signed chars
Date: Wed,  2 Nov 2022 19:46:55 +0100	[thread overview]
Message-ID: <20221102184659.2502-4-pablo@netfilter.org> (raw)
In-Reply-To: <20221102184659.2502-1-pablo@netfilter.org>

From: "Jason A. Donenfeld" <Jason@zx2c4.com>

The `char` type with no explicit sign is sometimes signed and sometimes
unsigned. This code will break on platforms such as arm, where char is
unsigned. So mark it here as explicitly signed, so that the
todrop_counter decrement and subsequent comparison is correct.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/ipvs/ip_vs_conn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 8c04bb57dd6f..7c4866c04343 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1265,8 +1265,8 @@ static inline int todrop_entry(struct ip_vs_conn *cp)
 	 * The drop rate array needs tuning for real environments.
 	 * Called from timer bh only => no locking
 	 */
-	static const char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
-	static char todrop_counter[9] = {0};
+	static const signed char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
+	static signed char todrop_counter[9] = {0};
 	int i;
 
 	/* if the conn entry hasn't lasted for 60 seconds, don't drop it.
-- 
2.30.2


  parent reply	other threads:[~2022-11-02 18:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 18:46 [PATCH net 0/7] Netfilter/IPVS fixes for net Pablo Neira Ayuso
2022-11-02 18:46 ` [PATCH net 1/7] netfilter: nf_tables: netlink notifier might race to release objects Pablo Neira Ayuso
2022-11-03  3:00   ` patchwork-bot+netdevbpf
2022-11-02 18:46 ` [PATCH net 2/7] netfilter: nf_tables: release flow rule object from commit path Pablo Neira Ayuso
2022-11-02 18:46 ` Pablo Neira Ayuso [this message]
2022-11-02 18:46 ` [PATCH net 4/7] ipvs: fix WARNING in __ip_vs_cleanup_batch() Pablo Neira Ayuso
2022-11-02 18:46 ` [PATCH net 5/7] ipvs: fix WARNING in ip_vs_app_net_cleanup() Pablo Neira Ayuso
2022-11-02 18:46 ` [PATCH net 6/7] netfilter: nf_nat: Fix possible memory leak in nf_nat_init() Pablo Neira Ayuso
2022-11-02 18:46 ` [PATCH net 7/7] netfilter: ipset: enforce documented limit to prevent allocating huge memory Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221102184659.2502-4-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox