Linux-Next Archive on
 help / color / Atom feed
From: Geert Uytterhoeven <>
To: Stephen Rothwell <>,
	Pablo Neira Ayuso <>
Cc: David Miller <>,
	Networking <>,
	Linux Next Mailing List <>,
	Linux Kernel Mailing List <>,
	NetFilter <>,
	Jiri Pirko <>,
	Jozsef Kadlecsik <>,
	Florian Westphal <>
Subject: nf_flow on big-endian (was: Re: linux-next: build warning after merge of the net-next tree)
Date: Tue, 26 Nov 2019 12:06:03 +0100
Message-ID: <> (raw)
In-Reply-To: <>

On Thu, Nov 21, 2019 at 8:36 AM Stephen Rothwell <> wrote:
> After merging the net-next tree, today's linux-next build (powerpc
> allyesconfig) produced this warning:
> net/netfilter/nf_flow_table_offload.c: In function 'nf_flow_rule_match':
> net/netfilter/nf_flow_table_offload.c:80:21: warning: unsigned conversion from 'int' to '__be16' {aka 'short unsigned int'} changes value from '327680' to '0' [-Woverflow]
>    80 |   mask->tcp.flags = TCP_FLAG_RST | TCP_FLAG_FIN;
>       |                     ^~~~~~~~~~~~
> Introduced by commit
>   c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support")

This is now upstream, and must be completely broken on big-endian

The other user of the flags field looks buggy, too

     key_tcp->flags = (*(__be16 *) &tcp_flag_word(th) & htons(0x0FFF));

Disclaimer: I'm not familiar with the code or protocol, so below are just
my gut feelings.

     struct flow_dissector_key_tcp {
            __be16 flags;

Does this have to be __be16, i.e. does it go over the wire?
If not, this should probably be __u16, and set using
"be32_to_cpu(flags) >> 16"?
If yes, "cpu_to_be16(be32_to_cpu(flags) >> 16)"?
(Ugh, needs convenience macros)

[*] ac4bb5de27010e41 ("net: flow_dissector: add support for dissection
of tcp flags")



Geert Uytterhoeven -- There's lots of Linux beyond ia32 --

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21  7:34 linux-next: build warning after merge of the net-next tree Stephen Rothwell
2019-11-26 11:06 ` Geert Uytterhoeven [this message]
2019-12-07 16:41   ` nf_flow on big-endian (was: Re: linux-next: build warning after merge of the net-next tree) Pablo Neira Ayuso
2019-12-08 10:33     ` Geert Uytterhoeven

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Next Archive on

Archives are clonable:
	git clone --mirror linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ \
	public-inbox-index linux-next

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone