[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <201801161410.5OcR7qOS%fengguang.wu@intel.com>
Date: Tue, 16 Jan 2018 14:57:41 +0800
From: kbuild test robot <lkp@...el.com>
To: Karim Eshapa <karim.eshapa@...il.com>
Cc: kbuild-all@...org, ast@...nel.org, daniel@...earbox.net,
davem@...emloft.net, ecree@...arflare.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Karim Eshapa <karim.eshapa@...il.com>
Subject: Re: [PATCH] Remove structure passing and assignment to save stack
and no coping structures.
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
Powered by blists - more mailing lists