All of lore.kernel.org
 help / color / mirror / Atom feed
* [kkdwivedi:fermata 41/49] net/ipv4/tcp_input.c:8020:18: warning: assignment to 'sk_buff_data_t' {aka 'unsigned char *'} from 'unsigned int' makes pointer from integer without a cast
@ 2026-10-02  0:03 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-10-02  0:03 UTC (permalink / raw)
  To: Kumar Kartikeya Dwivedi; +Cc: oe-kbuild-all

tree:   https://github.com/kkdwivedi/linux fermata
head:   babde5051be3840becf5a78de91a0b68a99f0e49
commit: ed7104db7e0a960eaf9b230f7cc1ffdea582b4b3 [41/49] tcp: Add XDP fast-path kfuncs for established connections
config: i386-randconfig-2103-20261001 (https://download.01.org/0day-ci/archive/20261002/202610020155.yNARu1IX-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261002/202610020155.yNARu1IX-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/202610020155.yNARu1IX-lkp@intel.com/

All warnings (new ones prefixed by >>):

   net/ipv4/tcp_input.c: In function 'bpf_xdp_tcp_consume':
>> net/ipv4/tcp_input.c:8020:18: warning: assignment to 'sk_buff_data_t' {aka 'unsigned char *'} from 'unsigned int' makes pointer from integer without a cast [-Wint-conversion]
    8020 |         skb->end = offsetof(typeof(fake), shinfo) - offsetof(typeof(fake), hdr);
         |                  ^
>> net/ipv4/tcp_input.c:8021:19: warning: assignment to 'sk_buff_data_t' {aka 'unsigned char *'} from 'u32' {aka 'unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
    8021 |         skb->tail = hlen;
         |                   ^


vim +8020 net/ipv4/tcp_input.c

  7977	
  7978	/**
  7979	 * bpf_xdp_tcp_consume - apply an in-order data segment to its connection
  7980	 * @sk: the socket from bpf_xdp_tcp_lookup()
  7981	 * @ctx: the frame
  7982	 * @info: as filled by bpf_xdp_tcp_lookup()
  7983	 *
  7984	 * Under the socket lock, takes the segment as tcp_rcv_established()'s fast
  7985	 * path would, with the payload counted as received and read rather than
  7986	 * queued for the application. The program must then drop the frame and is
  7987	 * responsible for answering it. Returns 0, or -EAGAIN when the socket is
  7988	 * owned by its user or the segment no longer fits the fast path: the frame
  7989	 * then belongs to the stack (XDP_PASS). The response must fit the socket's
  7990	 * send buffer: -ENOBUFS says it would not.
  7991	 */
  7992	__bpf_kfunc int bpf_xdp_tcp_consume(struct sock *sk, struct xdp_md *ctx,
  7993					    struct bpf_xdp_tcp_info *info)
  7994	{
  7995		struct xdp_buff *xdp = (struct xdp_buff *)ctx;
  7996		struct {
  7997			struct sk_buff skb;
  7998			u8 hdr[64] __aligned(8);
  7999			struct skb_shared_info shinfo;
  8000		} fake;
  8001		struct sk_buff *skb = &fake.skb;
  8002		struct tcp_sock *tp = tcp_sk(sk);
  8003		struct xdp_tcp_hdrs h;
  8004		const struct tcphdr *th;
  8005		u32 hlen, seq, end_seq;
  8006		int flag = 0, err = -EAGAIN;
  8007		s32 delta = 0;
  8008	
  8009		if (!xdp_tcp_parse(xdp, &h))
  8010			return -EINVAL;
  8011		th = h.th;
  8012		hlen = th->doff * 4;
  8013		seq = ntohl(th->seq);
  8014		end_seq = seq + h.payload_len;
  8015	
  8016		memset(&fake, 0, sizeof(fake));
  8017		memcpy(fake.hdr, th, hlen);
  8018		skb->head = fake.hdr;
  8019		skb->data = fake.hdr + hlen;
> 8020		skb->end = offsetof(typeof(fake), shinfo) - offsetof(typeof(fake), hdr);
> 8021		skb->tail = hlen;
  8022		skb->len = h.payload_len;
  8023		skb->truesize = SKB_TRUESIZE(h.payload_len + hlen);
  8024		skb_reset_transport_header(skb);
  8025		skb->transport_header = 0;
  8026		skb->protocol = htons(ETH_P_IP);
  8027		TCP_SKB_CB(skb)->seq = seq;
  8028		TCP_SKB_CB(skb)->end_seq = end_seq;
  8029		TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
  8030		TCP_SKB_CB(skb)->tcp_flags = tcp_flags_ntohs(th);
  8031		TCP_SKB_CB(skb)->ip_dsfield = ipv4_get_dsfield(h.iph);
  8032		TCP_SKB_CB(skb)->sacked = 0;
  8033	
  8034		bh_lock_sock_nested(sk);
  8035		if (sock_owned_by_user(sk) || sk->sk_state != TCP_ESTABLISHED)
  8036			goto out;
  8037		tcp_mstamp_refresh_inline(tp);
  8038		tp->rx_opt.saw_tstamp = 0;
  8039		tp->rx_opt.accecn = 0;
  8040		if (!xdp_tcp_fast_ok(tp, th, h.payload_len))
  8041			goto out;
  8042		if (tp->tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) {
  8043			if (!tcp_parse_aligned_timestamp(tp, th))
  8044				goto out;
  8045			delta = tp->rx_opt.rcv_tsval - tp->rx_opt.ts_recent;
  8046			if (delta < 0)
  8047				goto out;
  8048		}
  8049		/* The answer has to fit, since the segment cannot be handed back later. */
  8050		if (!sk_stream_memory_free(sk)) {
  8051			err = -ENOBUFS;
  8052			goto out;
  8053		}
  8054	
  8055		if (tp->tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED &&
  8056		    tp->rcv_nxt == tp->rcv_wup)
  8057			flag |= __tcp_replace_ts_recent(tp, delta);
  8058		tcp_rcv_rtt_measure_ts(sk, skb);
  8059		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS);
  8060		tcp_ecn_received_counters(sk, skb, h.payload_len);
  8061	
  8062		/* Received and read by the program, so nothing is queued. */
  8063		tcp_rcv_nxt_update(tp, end_seq);
  8064		WRITE_ONCE(tp->copied_seq, end_seq);
  8065		tcp_event_data_recv(sk, skb);
  8066	
  8067		if (TCP_SKB_CB(skb)->ack_seq != tp->snd_una ||
  8068		    (tcp_flag_word(th) & TCP_HP_BITS) != tp->pred_flags) {
  8069			/* The slow-path flag makes tcp_ack() take a window change. */
  8070			tcp_ack(sk, skb, flag | FLAG_DATA | FLAG_SLOWPATH);
  8071			tcp_data_snd_check(sk);
  8072			if (!inet_csk_ack_scheduled(sk))
  8073				goto done;
  8074		} else {
  8075			tcp_update_wl(tp, seq);
  8076		}
  8077		__tcp_ack_snd_check(sk, 0);
  8078	done:
  8079		err = 0;
  8080	out:
  8081		bh_unlock_sock(sk);
  8082		return err;
  8083	}
  8084	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-02  0:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-02  0:03 [kkdwivedi:fermata 41/49] net/ipv4/tcp_input.c:8020:18: warning: assignment to 'sk_buff_data_t' {aka 'unsigned char *'} from 'unsigned int' makes pointer from integer without a cast kernel test robot

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.