aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2013-04-18 21:33:59 -0400
committerSimon Horman <horms@verge.net.au>2013-04-22 22:43:06 -0400
commit9c37510b8ff2821ae4574858a6d4e83949c98a20 (patch)
tree4a3d017112e09a8e42d01648f3765ebadfce50ea /net/netfilter
parent9fd0fa7ac33bf073d81447b73d41c407fee54214 (diff)
ipvs: Use min3() in ip_vs_dbg_callid()
There are two motivations for this: 1. It improves readability to my eyes 2. Using nested min() calls results in a shadowed _min1 variable, which is a bit untidy. Sparse complained about this. I have also replaced (size_t)64 with a variable of type size_t and value 64. This also improves readability to my eyes. Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/ipvs/ip_vs_pe_sip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c
index 00cc0241ed87..9a8f4213e8a6 100644
--- a/net/netfilter/ipvs/ip_vs_pe_sip.c
+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c
@@ -13,7 +13,8 @@ static const char *ip_vs_dbg_callid(char *buf, size_t buf_len,
13 const char *callid, size_t callid_len, 13 const char *callid, size_t callid_len,
14 int *idx) 14 int *idx)
15{ 15{
16 size_t len = min(min(callid_len, (size_t)64), buf_len - *idx - 1); 16 size_t max_len = 64;
17 size_t len = min3(max_len, callid_len, buf_len - *idx - 1);
17 memcpy(buf + *idx, callid, len); 18 memcpy(buf + *idx, callid, len);
18 buf[*idx+len] = '\0'; 19 buf[*idx+len] = '\0';
19 *idx += len + 1; 20 *idx += len + 1;