* [PATCH] ebpf: fix parameter naming confusing
@ 2020-07-17 2:08 YangYuxi
2020-07-21 19:17 ` Alexei Starovoitov
0 siblings, 1 reply; 5+ messages in thread
From: YangYuxi @ 2020-07-17 2:08 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh, netdev, bpf, linux-kernel
Signed-off-by: YangYuxi <yx.atom1@gmail.com>
---
kernel/bpf/syscall.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 0fd80ac81f70..300ae16baffc 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -1881,13 +1881,13 @@ struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);
bool bpf_prog_get_ok(struct bpf_prog *prog,
- enum bpf_prog_type *attach_type, bool attach_drv)
+ enum bpf_prog_type *prog_type, bool attach_drv)
{
/* not an attachment, just a refcount inc, always allow */
- if (!attach_type)
+ if (!prog_type)
return true;
- if (prog->type != *attach_type)
+ if (prog->type != *prog_type)
return false;
if (bpf_prog_is_dev_bound(prog->aux) && !attach_drv)
return false;
@@ -1895,7 +1895,7 @@ bool bpf_prog_get_ok(struct bpf_prog *prog,
return true;
}
-static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *attach_type,
+static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *prog_type,
bool attach_drv)
{
struct fd f = fdget(ufd);
@@ -1904,7 +1904,7 @@ static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *attach_type,
prog = ____bpf_prog_get(f);
if (IS_ERR(prog))
return prog;
- if (!bpf_prog_get_ok(prog, attach_type, attach_drv)) {
+ if (!bpf_prog_get_ok(prog, prog_type, attach_drv)) {
prog = ERR_PTR(-EINVAL);
goto out;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ebpf: fix parameter naming confusing
2020-07-17 2:08 [PATCH] ebpf: fix parameter naming confusing YangYuxi
@ 2020-07-21 19:17 ` Alexei Starovoitov
0 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2020-07-21 19:17 UTC (permalink / raw)
To: YangYuxi
Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
Network Development, bpf, LKML
On Thu, Jul 16, 2020 at 7:08 PM YangYuxi <yx.atom1@gmail.com> wrote:
>
> Signed-off-by: YangYuxi <yx.atom1@gmail.com>
> ---
> kernel/bpf/syscall.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 0fd80ac81f70..300ae16baffc 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -1881,13 +1881,13 @@ struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
> EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);
>
> bool bpf_prog_get_ok(struct bpf_prog *prog,
> - enum bpf_prog_type *attach_type, bool attach_drv)
> + enum bpf_prog_type *prog_type, bool attach_drv)
> {
> /* not an attachment, just a refcount inc, always allow */
> - if (!attach_type)
> + if (!prog_type)
> return true;
I think it makes it worse.
Now the comment doesn't match the code.
And attach_drv name also looks out of place.
Technically program type is also an attach type to some degree.
The name could be a bit confusing, but in combination with type:
'enum bpf_prog_type *attach_type'
I think it's pretty clear what these functions are doing.
So I prefer to keep the code as-is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ebpf: fix parameter naming confusing
2020-07-16 13:41 YangYuxi
2020-07-16 15:18 ` kernel test robot
@ 2020-07-16 17:49 ` kernel test robot
1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-07-16 17:49 UTC (permalink / raw)
To: YangYuxi, ast, daniel, kafai, songliubraving, yhs, andriin,
john.fastabend, kpsingh, netdev, bpf
Cc: kbuild-all, clang-built-linux
[-- Attachment #1: Type: text/plain, Size: 2788 bytes --]
Hi YangYuxi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master net/master ipvs/master net-next/master v5.8-rc5 next-20200716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/YangYuxi/ebpf-fix-parameter-naming-confusing/20200716-214501
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: powerpc64-randconfig-r003-20200716 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ed6b578040a85977026c93bf4188f996148f3218)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> kernel/bpf/syscall.c:1887:7: error: use of undeclared identifier 'attach_type'
if (!attach_type)
^
1 error generated.
vim +/attach_type +1887 kernel/bpf/syscall.c
b16d9aa4c2b90a Martin KaFai Lau 2017-06-05 1882
040ee69226f8a9 Al Viro 2017-12-02 1883 bool bpf_prog_get_ok(struct bpf_prog *prog,
10eb063762081a YangYuxi 2020-07-16 1884 enum bpf_prog_type *prog_type, bool attach_drv)
248f346ffe9508 Jakub Kicinski 2017-11-03 1885 {
288b3de55aace8 Jakub Kicinski 2017-11-20 1886 /* not an attachment, just a refcount inc, always allow */
288b3de55aace8 Jakub Kicinski 2017-11-20 @1887 if (!attach_type)
288b3de55aace8 Jakub Kicinski 2017-11-20 1888 return true;
248f346ffe9508 Jakub Kicinski 2017-11-03 1889
10eb063762081a YangYuxi 2020-07-16 1890 if (prog->type != *prog_type)
248f346ffe9508 Jakub Kicinski 2017-11-03 1891 return false;
288b3de55aace8 Jakub Kicinski 2017-11-20 1892 if (bpf_prog_is_dev_bound(prog->aux) && !attach_drv)
248f346ffe9508 Jakub Kicinski 2017-11-03 1893 return false;
248f346ffe9508 Jakub Kicinski 2017-11-03 1894
248f346ffe9508 Jakub Kicinski 2017-11-03 1895 return true;
248f346ffe9508 Jakub Kicinski 2017-11-03 1896 }
248f346ffe9508 Jakub Kicinski 2017-11-03 1897
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28194 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ebpf: fix parameter naming confusing
2020-07-16 13:41 YangYuxi
@ 2020-07-16 15:18 ` kernel test robot
2020-07-16 17:49 ` kernel test robot
1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-07-16 15:18 UTC (permalink / raw)
To: YangYuxi, ast, daniel, kafai, songliubraving, yhs, andriin,
john.fastabend, kpsingh, netdev, bpf
Cc: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]
Hi YangYuxi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master net/master ipvs/master net-next/master v5.8-rc5 next-20200716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/YangYuxi/ebpf-fix-parameter-naming-confusing/20200716-214501
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: x86_64-rhel-7.6-kselftests (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
kernel/bpf/syscall.c: In function 'bpf_prog_get_ok':
>> kernel/bpf/syscall.c:1887:7: error: 'attach_type' undeclared (first use in this function); did you mean 'stack_type'?
1887 | if (!attach_type)
| ^~~~~~~~~~~
| stack_type
kernel/bpf/syscall.c:1887:7: note: each undeclared identifier is reported only once for each function it appears in
vim +1887 kernel/bpf/syscall.c
b16d9aa4c2b90a Martin KaFai Lau 2017-06-05 1882
040ee69226f8a9 Al Viro 2017-12-02 1883 bool bpf_prog_get_ok(struct bpf_prog *prog,
10eb063762081a YangYuxi 2020-07-16 1884 enum bpf_prog_type *prog_type, bool attach_drv)
248f346ffe9508 Jakub Kicinski 2017-11-03 1885 {
288b3de55aace8 Jakub Kicinski 2017-11-20 1886 /* not an attachment, just a refcount inc, always allow */
288b3de55aace8 Jakub Kicinski 2017-11-20 @1887 if (!attach_type)
288b3de55aace8 Jakub Kicinski 2017-11-20 1888 return true;
248f346ffe9508 Jakub Kicinski 2017-11-03 1889
10eb063762081a YangYuxi 2020-07-16 1890 if (prog->type != *prog_type)
248f346ffe9508 Jakub Kicinski 2017-11-03 1891 return false;
288b3de55aace8 Jakub Kicinski 2017-11-20 1892 if (bpf_prog_is_dev_bound(prog->aux) && !attach_drv)
248f346ffe9508 Jakub Kicinski 2017-11-03 1893 return false;
248f346ffe9508 Jakub Kicinski 2017-11-03 1894
248f346ffe9508 Jakub Kicinski 2017-11-03 1895 return true;
248f346ffe9508 Jakub Kicinski 2017-11-03 1896 }
248f346ffe9508 Jakub Kicinski 2017-11-03 1897
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49992 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ebpf: fix parameter naming confusing
@ 2020-07-16 13:41 YangYuxi
2020-07-16 15:18 ` kernel test robot
2020-07-16 17:49 ` kernel test robot
0 siblings, 2 replies; 5+ messages in thread
From: YangYuxi @ 2020-07-16 13:41 UTC (permalink / raw)
To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh, netdev, bpf, linux-kernel
Signed-off-by: YangYuxi <yx.atom1@gmail.com>
---
kernel/bpf/syscall.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 0fd80ac81f70..42406f7275b7 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -1881,13 +1881,13 @@ struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);
bool bpf_prog_get_ok(struct bpf_prog *prog,
- enum bpf_prog_type *attach_type, bool attach_drv)
+ enum bpf_prog_type *prog_type, bool attach_drv)
{
/* not an attachment, just a refcount inc, always allow */
if (!attach_type)
return true;
- if (prog->type != *attach_type)
+ if (prog->type != *prog_type)
return false;
if (bpf_prog_is_dev_bound(prog->aux) && !attach_drv)
return false;
@@ -1895,7 +1895,7 @@ bool bpf_prog_get_ok(struct bpf_prog *prog,
return true;
}
-static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *attach_type,
+static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *prog_type,
bool attach_drv)
{
struct fd f = fdget(ufd);
@@ -1904,7 +1904,7 @@ static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *attach_type,
prog = ____bpf_prog_get(f);
if (IS_ERR(prog))
return prog;
- if (!bpf_prog_get_ok(prog, attach_type, attach_drv)) {
+ if (!bpf_prog_get_ok(prog, prog_type, attach_drv)) {
prog = ERR_PTR(-EINVAL);
goto out;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-07-21 19:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 2:08 [PATCH] ebpf: fix parameter naming confusing YangYuxi
2020-07-21 19:17 ` Alexei Starovoitov
-- strict thread matches above, loose matches on Subject: below --
2020-07-16 13:41 YangYuxi
2020-07-16 15:18 ` kernel test robot
2020-07-16 17:49 ` kernel test robot
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).