Skip to content

Commit a1d0cd8

Browse files
shlomopongratzdavem330
authored andcommitted
net/udp_offload: Handle static checker complaints
Fixed few issues around using __rcu prefix and rcu_assign_pointer, also fixed a warning print to use ntohs(port) and not htons(port). net/ipv4/udp_offload.c:112:9: error: incompatible types in comparison expression (different address spaces) net/ipv4/udp_offload.c:113:9: error: incompatible types in comparison expression (different address spaces) net/ipv4/udp_offload.c:176:19: error: incompatible types in comparison expression (different address spaces) Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3ad88cf commit a1d0cd8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/ipv4/udp_offload.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <net/protocol.h>
1616

1717
static DEFINE_SPINLOCK(udp_offload_lock);
18-
static struct udp_offload_priv *udp_offload_base __read_mostly;
18+
static struct udp_offload_priv __rcu *udp_offload_base __read_mostly;
1919

2020
struct udp_offload_priv {
2121
struct udp_offload *offload;
@@ -100,7 +100,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
100100

101101
int udp_add_offload(struct udp_offload *uo)
102102
{
103-
struct udp_offload_priv **head = &udp_offload_base;
103+
struct udp_offload_priv __rcu **head = &udp_offload_base;
104104
struct udp_offload_priv *new_offload = kzalloc(sizeof(*new_offload), GFP_KERNEL);
105105

106106
if (!new_offload)
@@ -110,7 +110,7 @@ int udp_add_offload(struct udp_offload *uo)
110110

111111
spin_lock(&udp_offload_lock);
112112
rcu_assign_pointer(new_offload->next, rcu_dereference(*head));
113-
rcu_assign_pointer(*head, rcu_dereference(new_offload));
113+
rcu_assign_pointer(*head, new_offload);
114114
spin_unlock(&udp_offload_lock);
115115

116116
return 0;
@@ -140,7 +140,7 @@ void udp_del_offload(struct udp_offload *uo)
140140
}
141141
head = &uo_priv->next;
142142
}
143-
pr_warn("udp_del_offload: didn't find offload for port %d\n", htons(uo->port));
143+
pr_warn("udp_del_offload: didn't find offload for port %d\n", ntohs(uo->port));
144144
unlock:
145145
spin_unlock(&udp_offload_lock);
146146
if (uo_priv != NULL)

0 commit comments

Comments
 (0)