From: kernel test robot <lkp@intel.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Alexei Starovoitov <ast@kernel.org>
Subject: kernel/bpf/bpf_iter.c:789:17: warning: no previous declaration for 'bpf_iter_num_new'
Date: Tue, 12 Sep 2023 01:57:42 +0800 [thread overview]
Message-ID: <202309120150.uX27LKII-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
commit: 6018e1f407cccf39b804d1f75ad4de7be4e6cc45 bpf: implement numbers iterator
date: 6 months ago
config: x86_64-randconfig-002-20230910 (https://download.01.org/0day-ci/archive/20230912/202309120150.uX27LKII-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230912/202309120150.uX27LKII-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309120150.uX27LKII-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/bpf/bpf_iter.c:789:17: warning: no previous declaration for 'bpf_iter_num_new' [-Wmissing-declarations]
__bpf_kfunc int bpf_iter_num_new(struct bpf_iter_num *it, int start, int end)
^~~~~~~~~~~~~~~~
>> kernel/bpf/bpf_iter.c:822:18: warning: no previous declaration for 'bpf_iter_num_next' [-Wmissing-declarations]
__bpf_kfunc int *bpf_iter_num_next(struct bpf_iter_num* it)
^~~~~~~~~~~~~~~~~
>> kernel/bpf/bpf_iter.c:841:18: warning: no previous declaration for 'bpf_iter_num_destroy' [-Wmissing-declarations]
__bpf_kfunc void bpf_iter_num_destroy(struct bpf_iter_num *it)
^~~~~~~~~~~~~~~~~~~~
vim +/bpf_iter_num_new +789 kernel/bpf/bpf_iter.c
784
785 __diag_push();
786 __diag_ignore_all("-Wmissing-prototypes",
787 "Global functions as their definitions will be in vmlinux BTF");
788
> 789 __bpf_kfunc int bpf_iter_num_new(struct bpf_iter_num *it, int start, int end)
790 {
791 struct bpf_iter_num_kern *s = (void *)it;
792
793 BUILD_BUG_ON(sizeof(struct bpf_iter_num_kern) != sizeof(struct bpf_iter_num));
794 BUILD_BUG_ON(__alignof__(struct bpf_iter_num_kern) != __alignof__(struct bpf_iter_num));
795
796 BTF_TYPE_EMIT(struct btf_iter_num);
797
798 /* start == end is legit, it's an empty range and we'll just get NULL
799 * on first (and any subsequent) bpf_iter_num_next() call
800 */
801 if (start > end) {
802 s->cur = s->end = 0;
803 return -EINVAL;
804 }
805
806 /* avoid overflows, e.g., if start == INT_MIN and end == INT_MAX */
807 if ((s64)end - (s64)start > BPF_MAX_LOOPS) {
808 s->cur = s->end = 0;
809 return -E2BIG;
810 }
811
812 /* user will call bpf_iter_num_next() first,
813 * which will set s->cur to exactly start value;
814 * underflow shouldn't matter
815 */
816 s->cur = start - 1;
817 s->end = end;
818
819 return 0;
820 }
821
> 822 __bpf_kfunc int *bpf_iter_num_next(struct bpf_iter_num* it)
823 {
824 struct bpf_iter_num_kern *s = (void *)it;
825
826 /* check failed initialization or if we are done (same behavior);
827 * need to be careful about overflow, so convert to s64 for checks,
828 * e.g., if s->cur == s->end == INT_MAX, we can't just do
829 * s->cur + 1 >= s->end
830 */
831 if ((s64)(s->cur + 1) >= s->end) {
832 s->cur = s->end = 0;
833 return NULL;
834 }
835
836 s->cur++;
837
838 return &s->cur;
839 }
840
> 841 __bpf_kfunc void bpf_iter_num_destroy(struct bpf_iter_num *it)
842 {
843 struct bpf_iter_num_kern *s = (void *)it;
844
845 s->cur = s->end = 0;
846 }
847
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-09-11 22:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202309120150.uX27LKII-lkp@intel.com \
--to=lkp@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/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
all inboxes | Powered by JetHome®