Skip to content

Commit 75e7ce6

Browse files
Al ViroDavid S. Miller
authored andcommitted
[IPVS]: Annotate ..._app_hashkey().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a64b78a commit 75e7ce6

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎net/ipv4/ipvs/ip_vs_proto_tcp.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,16 +490,18 @@ tcp_state_transition(struct ip_vs_conn *cp, int direction,
490490
static struct list_head tcp_apps[TCP_APP_TAB_SIZE];
491491
static DEFINE_SPINLOCK(tcp_app_lock);
492492

493-
static inline __u16 tcp_app_hashkey(__u16 port)
493+
static inline __u16 tcp_app_hashkey(__be16 port)
494494
{
495-
return ((port >> TCP_APP_TAB_BITS) ^ port) & TCP_APP_TAB_MASK;
495+
return (((__force u16)port >> TCP_APP_TAB_BITS) ^ (__force u16)port)
496+
& TCP_APP_TAB_MASK;
496497
}
497498

498499

499500
static int tcp_register_app(struct ip_vs_app *inc)
500501
{
501502
struct ip_vs_app *i;
502-
__u16 hash, port = inc->port;
503+
__u16 hash;
504+
__be16 port = inc->port;
503505
int ret = 0;
504506

505507
hash = tcp_app_hashkey(port);

‎net/ipv4/ipvs/ip_vs_proto_udp.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,18 @@ udp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp)
282282
static struct list_head udp_apps[UDP_APP_TAB_SIZE];
283283
static DEFINE_SPINLOCK(udp_app_lock);
284284

285-
static inline __u16 udp_app_hashkey(__u16 port)
285+
static inline __u16 udp_app_hashkey(__be16 port)
286286
{
287-
return ((port >> UDP_APP_TAB_BITS) ^ port) & UDP_APP_TAB_MASK;
287+
return (((__force u16)port >> UDP_APP_TAB_BITS) ^ (__force u16)port)
288+
& UDP_APP_TAB_MASK;
288289
}
289290

290291

291292
static int udp_register_app(struct ip_vs_app *inc)
292293
{
293294
struct ip_vs_app *i;
294-
__u16 hash, port = inc->port;
295+
__u16 hash;
296+
__be16 port = inc->port;
295297
int ret = 0;
296298

297299
hash = udp_app_hashkey(port);

0 commit comments

Comments
 (0)