From: David Laight <david.laight.linux@gmail.com>
It is invalid to use sizeof() or typeof() in bitfields which stops
them being passed to max().
This has been fixed by using max_t().
I want to add some checks to max_t() to detect cases where the cast
discards non-zero high bits - which uses sizeof().
So add 0 to the bitfield (converting it to int) then use max().
Signed-off-by: David Laight <david.laight.linux@gmail.com>
---
include/net/tcp_ecn.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index f13e5cd2b1ac..14c00404a95f 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -196,7 +196,7 @@ static inline void tcp_accecn_opt_demand_min(struct sock *sk,
struct tcp_sock *tp = tcp_sk(sk);
u8 opt_demand;
- opt_demand = max_t(u8, opt_demand_min, tp->accecn_opt_demand);
+ opt_demand = max(opt_demand_min, tp->accecn_opt_demand + 0);
tp->accecn_opt_demand = opt_demand;
}
@@ -303,8 +303,7 @@ static inline void tcp_ecn_received_counters(struct sock *sk,
u32 bytes_mask = GENMASK_U32(31, 22);
tp->received_ecn_bytes[ecnfield - 1] += len;
- tp->accecn_minlen = max_t(u8, tp->accecn_minlen,
- minlen);
+ tp->accecn_minlen = max(tp->accecn_minlen + 0, minlen);
/* Send AccECN option at least once per 2^22-byte
* increase in any ECN byte counter.
--
2.39.5