From: kernel test robot <lkp@intel.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [kkdwivedi:xdp-tcp 23/41] net/ipv4/tcp_xdp.c:207:11: warning: assignment to 'sk_buff_data_t' {aka 'unsigned char *'} from 'unsigned int' makes pointer from integer without a cast
Date: Tue, 06 Oct 2026 17:52:06 +0200 [thread overview]
Message-ID: <202610061748.HmqAPwtR-lkp@intel.com> (raw)
tree: https://github.com/kkdwivedi/linux xdp-tcp
head: 98ba2e45e6a3e93f19f6579031bd9e6995b9ca4c
commit: 58e507a65c23a2eae4fb2c22568f97c57f661df0 [23/41] tcp: Add XDP fast-path kfuncs for established connections
config: arm-randconfig-r2200-20261006 (https://download.01.org/0day-ci/archive/20261006/202610061748.HmqAPwtR-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261006/202610061748.HmqAPwtR-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610061748.HmqAPwtR-lkp@intel.com/
All warnings (new ones prefixed by >>):
net/ipv4/tcp_xdp.c: In function 'bpf_xdp_tcp_consume':
>> net/ipv4/tcp_xdp.c:207:11: warning: assignment to 'sk_buff_data_t' {aka 'unsigned char *'} from 'unsigned int' makes pointer from integer without a cast [-Wint-conversion]
skb->end = offsetof(typeof(fake), shinfo) - offsetof(typeof(fake), hdr);
^
>> net/ipv4/tcp_xdp.c:208:12: warning: assignment to 'sk_buff_data_t' {aka 'unsigned char *'} from 'u32' {aka 'unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
skb->tail = hlen;
^
vim +207 net/ipv4/tcp_xdp.c
163
164 /**
165 * bpf_xdp_tcp_consume - apply an in-order data segment to its connection
166 * @sk: the socket from bpf_xdp_tcp_lookup()
167 * @ctx: the frame
168 * @info: as filled by bpf_xdp_tcp_lookup()
169 *
170 * Under the socket lock, takes the segment as tcp_rcv_established()'s fast
171 * path would, with the payload counted as received and read rather than
172 * queued for the application. The program must then drop the frame and is
173 * responsible for answering it. Returns 0, or -EAGAIN when the socket is
174 * owned by its user or the segment no longer fits the fast path: the frame
175 * then belongs to the stack (XDP_PASS). The response must fit the socket's
176 * send buffer: -ENOBUFS says it would not.
177 */
178 __bpf_kfunc int bpf_xdp_tcp_consume(struct sock *sk, struct xdp_md *ctx,
179 struct bpf_xdp_tcp_info *info)
180 {
181 struct xdp_buff *xdp = (struct xdp_buff *)ctx;
182 struct {
183 struct sk_buff skb;
184 u8 hdr[64] __aligned(8);
185 struct skb_shared_info shinfo;
186 } fake;
187 struct sk_buff *skb = &fake.skb;
188 struct tcp_sock *tp = tcp_sk(sk);
189 struct xdp_tcp_hdrs h;
190 const struct tcphdr *th;
191 u32 hlen, seq, end_seq;
192 bool ts_progress = false;
193 int err = -EAGAIN;
194 s32 delta = 0;
195
196 if (!xdp_tcp_parse(xdp, &h))
197 return -EINVAL;
198 th = h.th;
199 hlen = th->doff * 4;
200 seq = ntohl(th->seq);
201 end_seq = seq + h.payload_len;
202
203 memset(&fake, 0, sizeof(fake));
204 memcpy(fake.hdr, th, hlen);
205 skb->head = fake.hdr;
206 skb->data = fake.hdr + hlen;
> 207 skb->end = offsetof(typeof(fake), shinfo) - offsetof(typeof(fake), hdr);
> 208 skb->tail = hlen;
209 skb->len = h.payload_len;
210 skb->truesize = SKB_TRUESIZE(h.payload_len + hlen);
211 skb_reset_transport_header(skb);
212 skb->transport_header = 0;
213 skb->protocol = htons(ETH_P_IP);
214 TCP_SKB_CB(skb)->seq = seq;
215 TCP_SKB_CB(skb)->end_seq = end_seq;
216 TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
217 TCP_SKB_CB(skb)->tcp_flags = tcp_flags_ntohs(th);
218 TCP_SKB_CB(skb)->ip_dsfield = ipv4_get_dsfield(h.iph);
219 TCP_SKB_CB(skb)->sacked = 0;
220
221 bh_lock_sock_nested(sk);
222 if (sock_owned_by_user(sk) || sk->sk_state != TCP_ESTABLISHED)
223 goto out;
224 tcp_mstamp_refresh_inline(tp);
225 tp->rx_opt.saw_tstamp = 0;
226 tp->rx_opt.accecn = 0;
227 if (!xdp_tcp_fast_ok(tp, th, h.payload_len))
228 goto out;
229 if (tp->tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) {
230 if (!tcp_parse_aligned_timestamp(tp, th))
231 goto out;
232 delta = tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent;
233 if (delta < 0)
234 goto out;
235 }
236 /* The answer has to fit, since the segment cannot be handed back later. */
237 if (!sk_stream_memory_free(sk)) {
238 err = -ENOBUFS;
239 goto out;
240 }
241
242 if (tp->tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED &&
243 tp->rcv_nxt == tp->rcv_wup)
244 ts_progress = tcp_xdp_replace_ts_recent(tp, delta);
245 tcp_rcv_rtt_measure_ts(sk, skb);
246 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS);
247 tcp_ecn_received_counters(sk, skb, h.payload_len);
248
249 /* Received and read by the program, so nothing is queued. */
250 tcp_rcv_nxt_update(tp, end_seq);
251 WRITE_ONCE(tp->copied_seq, end_seq);
252 tcp_event_data_recv(sk, skb);
253
254 if (TCP_SKB_CB(skb)->ack_seq != tp->snd_una ||
255 (tcp_flag_word(th) & XDP_TCP_HP_BITS) != tp->pred_flags) {
256 /* The slow-path flag makes tcp_ack() take a window change. */
257 tcp_xdp_ack(sk, skb, ts_progress);
258 if (!inet_csk_ack_scheduled(sk))
259 goto done;
260 } else {
261 tcp_update_wl(tp, seq);
262 }
263 __tcp_ack_snd_check(sk, 0);
264 done:
265 err = 0;
266 out:
267 bh_unlock_sock(sk);
268 return err;
269 }
270
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-10-06 15:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202610061748.HmqAPwtR-lkp@intel.com \
--to=lkp@intel.com \
--cc=memxor@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.