linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Jihong <yangjihong1@huawei.com>
To: Yonghong Song <yhs@meta.com>, <ast@kernel.org>,
	<daniel@iogearbox.net>, <davem@davemloft.net>, <kuba@kernel.org>,
	<hawk@kernel.org>, <john.fastabend@gmail.com>,
	<andrii@kernel.org>, <martin.lau@linux.dev>, <song@kernel.org>,
	<yhs@fb.com>, <kpsingh@kernel.org>, <sdf@google.com>,
	<haoluo@google.com>, <jolsa@kernel.org>, <mykolal@fb.com>,
	<shuah@kernel.org>, <tariqt@nvidia.com>, <maximmi@nvidia.com>,
	<netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch
Date: Fri, 11 Nov 2022 11:11:37 +0800	[thread overview]
Message-ID: <f5391830-352a-6daa-9233-a177db43ba71@huawei.com> (raw)
In-Reply-To: <c8bd9f3b-52fa-08bd-e5df-e87b68ffdbba@meta.com>

Hello,

On 2022/11/8 23:59, Yonghong Song wrote:
> 
> 
> On 11/8/22 5:12 AM, Yang Jihong wrote:
>> xdp_synproxy fails to be compiled in the 32-bit arch, log is as follows:
>>
>>    xdp_synproxy.c: In function 'parse_options':
>>    xdp_synproxy.c:175:36: error: left shift count >= width of type 
>> [-Werror=shift-count-overflow]
>>      175 |                 *tcpipopts = (mss6 << 32) | (ttl << 24) | 
>> (wscale << 16) | mss4;
>>          |                                    ^~
>>    xdp_synproxy.c: In function 'syncookie_open_bpf_maps':
>>    xdp_synproxy.c:289:28: error: cast from pointer to integer of 
>> different size [-Werror=pointer-to-int-cast]
>>      289 |                 .map_ids = (__u64)map_ids,
>>          |                            ^
>>
>> Fix it.
>>
>> Fixes: fb5cd0ce70d4 ("selftests/bpf: Add selftests for raw syncookie 
>> helpers")
>> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
>> ---
>>   tools/testing/selftests/bpf/xdp_synproxy.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/xdp_synproxy.c 
>> b/tools/testing/selftests/bpf/xdp_synproxy.c
>> index ff35320d2be9..45fef01a87a8 100644
>> --- a/tools/testing/selftests/bpf/xdp_synproxy.c
>> +++ b/tools/testing/selftests/bpf/xdp_synproxy.c
>> @@ -172,7 +172,7 @@ static void parse_options(int argc, char *argv[], 
>> unsigned int *ifindex, __u32 *
>>       if (tcpipopts_mask == 0xf) {
>>           if (mss4 == 0 || mss6 == 0 || wscale == 0 || ttl == 0)
>>               usage(argv[0]);
>> -        *tcpipopts = (mss6 << 32) | (ttl << 24) | (wscale << 16) | mss4;
>> +        *tcpipopts = ((unsigned long long)mss6 << 32) | (ttl << 24) | 
>> (wscale << 16) | mss4;
> 
> This looks weird. Maybe we should define mss6 as unsigned long long to 
> avoid this casting at all?
OK, will fix in next version.

Thanks,
Yang

      reply	other threads:[~2022-11-11  3:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 13:12 [PATCH bpf] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch Yang Jihong
2022-11-08 15:59 ` Yonghong Song
2022-11-11  3:11   ` Yang Jihong [this message]

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=f5391830-352a-6daa-9233-a177db43ba71@huawei.com \
    --to=yangjihong1@huawei.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=maximmi@nvidia.com \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tariqt@nvidia.com \
    --cc=yhs@fb.com \
    --cc=yhs@meta.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).