From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751199AbeAPG6I (ORCPT + 1 other); Tue, 16 Jan 2018 01:58:08 -0500 Received: from mga06.intel.com ([134.134.136.31]:57780 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbeAPG6G (ORCPT ); Tue, 16 Jan 2018 01:58:06 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,367,1511856000"; d="scan'208";a="10055074" Date: Tue, 16 Jan 2018 14:57:41 +0800 From: kbuild test robot To: Karim Eshapa 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 Subject: Re: [PATCH] Remove structure passing and assignment to save stack and no coping structures. Message-ID: <201801161410.5OcR7qOS%fengguang.wu@intel.com> References: <1515871608-11351-1-git-send-email-karim.eshapa@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1515871608-11351-1-git-send-email-karim.eshapa@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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