From: kbuild test robot <lkp@intel.com>
To: Karim Eshapa <karim.eshapa@gmail.com>
Cc: kbuild-all@01.org, ast@kernel.org, daniel@iogearbox.net,
davem@davemloft.net, ecree@solarflare.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Karim Eshapa <karim.eshapa@gmail.com>
Subject: Re: [PATCH] Remove structure passing and assignment to save stack and no coping structures.
Date: Tue, 16 Jan 2018 14:57:41 +0800 [thread overview]
Message-ID: <201801161410.5OcR7qOS%fengguang.wu@intel.com> (raw)
In-Reply-To: <1515871608-11351-1-git-send-email-karim.eshapa@gmail.com>
Hi Karim,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.15-rc8 next-20180115]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Karim-Eshapa/Remove-structure-passing-and-assignment-to-save-stack-and-no-coping-structures/20180116-130502
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
>> kernel/bpf/verifier.c:1002:29: sparse: incorrect type in argument 2 (different modifiers) @@ expected struct tnum @@ got structstruct tnum @@
kernel/bpf/verifier.c:1002:29: expected struct tnum
kernel/bpf/verifier.c:1002:29: got struct tnum const
>> kernel/bpf/verifier.c:1003:17: sparse: not addressable
kernel/bpf/verifier.c:1028:29: sparse: incorrect type in argument 2 (different modifiers) @@ expected struct tnum @@ got structstruct tnum @@
kernel/bpf/verifier.c:1028:29: expected struct tnum
kernel/bpf/verifier.c:1028:29: got struct tnum const
kernel/bpf/verifier.c:1029:17: sparse: not addressable
kernel/bpf/verifier.c:1969:46: sparse: incorrect type in argument 2 (different modifiers) @@ expected struct tnum @@ got structstruct tnum @@
kernel/bpf/verifier.c:1969:46: expected struct tnum
kernel/bpf/verifier.c:1969:46: got struct tnum const
>> kernel/bpf/verifier.c:1970:26: sparse: incorrect type in argument 3 (different modifiers) @@ expected struct tnum lib @@ got structstruct tnum lib @@
kernel/bpf/verifier.c:1970:26: expected struct tnum lib
kernel/bpf/verifier.c:1970:26: got struct tnum const
kernel/bpf/verifier.c:4527:38: sparse: subtraction of Share your drugs
>> kernel/bpf/verifier.c:1002:17: sparse: call with no type!
kernel/bpf/verifier.c:1028:17: sparse: call with no type!
kernel/bpf/verifier.c: In function 'check_pkt_ptr_alignment':
kernel/bpf/verifier.c:1003:3: error: lvalue required as unary '&' operand
&tnum_const(ip_align + reg->off + off));
^
kernel/bpf/verifier.c:1002:21: warning: passing argument 2 of 'tnum_add' discards 'const' qualifier from pointer target type
tnum_add(®_off, ®->var_off,
^
In file included from include/linux/bpf_verifier.h:12:0,
from kernel/bpf/verifier.c:17:
include/linux/tnum.h:29:6: note: expected 'struct tnum but argument is of type 'const struct tnum
void tnum_add(struct tnum struct tnum struct tnum
^~~~~~~~
kernel/bpf/verifier.c: In function 'check_generic_ptr_alignment':
kernel/bpf/verifier.c:1029:3: error: lvalue required as unary '&' operand
&tnum_const(reg->off + off));
^
kernel/bpf/verifier.c:1028:21: warning: passing argument 2 of 'tnum_add' discards 'const' qualifier from pointer target type
tnum_add(®_off, ®->var_off,
^
In file included from include/linux/bpf_verifier.h:12:0,
from kernel/bpf/verifier.c:17:
include/linux/tnum.h:29:6: note: expected 'struct tnum but argument is of type 'const struct tnum
void tnum_add(struct tnum struct tnum struct tnum
^~~~~~~~
kernel/bpf/verifier.c: In function 'adjust_ptr_min_max_vals':
kernel/bpf/verifier.c:1969:31: warning: passing argument 2 of 'tnum_add' discards 'const' qualifier from pointer target type
tnum_add(&dst_reg->var_off, &ptr_reg->var_off,
^
In file included from include/linux/bpf_verifier.h:12:0,
from kernel/bpf/verifier.c:17:
include/linux/tnum.h:29:6: note: expected 'struct tnum but argument is of type 'const struct tnum
void tnum_add(struct tnum struct tnum struct tnum
^~~~~~~~
kernel/bpf/verifier.c:1970:4: warning: passing argument 3 of 'tnum_add' discards 'const' qualifier from pointer target type
&off_reg->var_off);
^
In file included from include/linux/bpf_verifier.h:12:0,
from kernel/bpf/verifier.c:17:
include/linux/tnum.h:29:6: note: expected 'struct tnum but argument is of type 'const struct tnum
void tnum_add(struct tnum struct tnum struct tnum
^~~~~~~~
vim +1002 kernel/bpf/verifier.c
980
981 static int check_pkt_ptr_alignment(struct bpf_verifier_env *env,
982 const struct bpf_reg_state *reg,
983 int off, int size, bool strict)
984 {
985 struct tnum reg_off;
986 int ip_align;
987
988 /* Byte size accesses are always allowed. */
989 if (!strict || size == 1)
990 return 0;
991
992 /* For platforms that do not have a Kconfig enabling
993 * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS the value of
994 * NET_IP_ALIGN is universally set to '2'. And on platforms
995 * that do set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, we get
996 * to this code only in strict mode where we want to emulate
997 * the NET_IP_ALIGN==2 checking. Therefore use an
998 * unconditional IP align value of '2'.
999 */
1000 ip_align = 2;
1001
> 1002 tnum_add(®_off, ®->var_off,
> 1003 &tnum_const(ip_align + reg->off + off));
1004 if (!tnum_is_aligned(reg_off, size)) {
1005 char tn_buf[48];
1006
1007 tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
1008 verbose(env,
1009 "misaligned packet access off %d+%s+%d+%d size %d\n",
1010 ip_align, tn_buf, reg->off, off, size);
1011 return -EACCES;
1012 }
1013
1014 return 0;
1015 }
1016
1017 static int check_generic_ptr_alignment(struct bpf_verifier_env *env,
1018 const struct bpf_reg_state *reg,
1019 const char *pointer_desc,
1020 int off, int size, bool strict)
1021 {
1022 struct tnum reg_off;
1023
1024 /* Byte size accesses are always allowed. */
1025 if (!strict || size == 1)
1026 return 0;
1027
> 1028 tnum_add(®_off, ®->var_off,
1029 &tnum_const(reg->off + off));
1030 if (!tnum_is_aligned(reg_off, size)) {
1031 char tn_buf[48];
1032
1033 tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
1034 verbose(env, "misaligned %saccess off %s+%d+%d size %d\n",
1035 pointer_desc, tn_buf, reg->off, off, size);
1036 return -EACCES;
1037 }
1038
1039 return 0;
1040 }
1041
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next prev parent reply other threads:[~2018-01-16 6:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-13 19:26 [PATCH] Remove structure passing and assignment to save stack and no coping structures Karim Eshapa
2018-01-16 6:57 ` kbuild test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-01-13 18:48 Karim Eshapa
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=201801161410.5OcR7qOS%fengguang.wu@intel.com \
--to=lkp@intel.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ecree@solarflare.com \
--cc=karim.eshapa@gmail.com \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).