* [PATCH net-next] net: filter: remove unused variable and fix warning
@ 2017-10-30 20:46 Jakub Kicinski
2017-10-30 21:13 ` Lawrence Brakmo
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jakub Kicinski @ 2017-10-30 20:46 UTC (permalink / raw)
To: netdev
Cc: oss-drivers, alexei.starovoitov, daniel, Lawrence Brakmo,
Jakub Kicinski
bpf_getsockopt bpf call sets the ret variable to zero and
never changes it. What's worse in case CONFIG_INET is
not selected the variable is completely unused generating
a warning.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
net/core/filter.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 721c30889033..a0112168d6f9 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3288,7 +3288,6 @@ BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock,
int, level, int, optname, char *, optval, int, optlen)
{
struct sock *sk = bpf_sock->sk;
- int ret = 0;
if (!sk_fullsock(sk))
goto err_clear;
@@ -3308,7 +3307,7 @@ BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock,
} else {
goto err_clear;
}
- return ret;
+ return 0;
#endif
err_clear:
memset(optval, 0, optlen);
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next] net: filter: remove unused variable and fix warning
2017-10-30 20:46 [PATCH net-next] net: filter: remove unused variable and fix warning Jakub Kicinski
@ 2017-10-30 21:13 ` Lawrence Brakmo
2017-10-30 21:55 ` Daniel Borkmann
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Lawrence Brakmo @ 2017-10-30 21:13 UTC (permalink / raw)
To: Jakub Kicinski, netdev@vger.kernel.org
Cc: oss-drivers@netronome.com, alexei.starovoitov@gmail.com,
daniel@iogearbox.net
Good catch, thanks!
On 10/30/17, 1:47 PM, "Jakub Kicinski" <jakub.kicinski@netronome.com> wrote:
bpf_getsockopt bpf call sets the ret variable to zero and
never changes it. What's worse in case CONFIG_INET is
not selected the variable is completely unused generating
a warning.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Lawrence Brakmo <brakmo@fb.com>
---
net/core/filter.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 721c30889033..a0112168d6f9 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3288,7 +3288,6 @@ BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock,
int, level, int, optname, char *, optval, int, optlen)
{
struct sock *sk = bpf_sock->sk;
- int ret = 0;
if (!sk_fullsock(sk))
goto err_clear;
@@ -3308,7 +3307,7 @@ BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock,
} else {
goto err_clear;
}
- return ret;
+ return 0;
#endif
err_clear:
memset(optval, 0, optlen);
--
2.14.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net-next] net: filter: remove unused variable and fix warning
2017-10-30 20:46 [PATCH net-next] net: filter: remove unused variable and fix warning Jakub Kicinski
2017-10-30 21:13 ` Lawrence Brakmo
@ 2017-10-30 21:55 ` Daniel Borkmann
2017-10-30 21:56 ` Alexei Starovoitov
2017-10-31 0:26 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2017-10-30 21:55 UTC (permalink / raw)
To: Jakub Kicinski, netdev; +Cc: oss-drivers, alexei.starovoitov, Lawrence Brakmo
On 10/30/2017 09:46 PM, Jakub Kicinski wrote:
> bpf_getsockopt bpf call sets the ret variable to zero and
> never changes it. What's worse in case CONFIG_INET is
> not selected the variable is completely unused generating
> a warning.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: filter: remove unused variable and fix warning
2017-10-30 20:46 [PATCH net-next] net: filter: remove unused variable and fix warning Jakub Kicinski
2017-10-30 21:13 ` Lawrence Brakmo
2017-10-30 21:55 ` Daniel Borkmann
@ 2017-10-30 21:56 ` Alexei Starovoitov
2017-10-31 0:26 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2017-10-30 21:56 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, oss-drivers, daniel, Lawrence Brakmo
On Mon, Oct 30, 2017 at 01:46:47PM -0700, Jakub Kicinski wrote:
> bpf_getsockopt bpf call sets the ret variable to zero and
> never changes it. What's worse in case CONFIG_INET is
> not selected the variable is completely unused generating
> a warning.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: filter: remove unused variable and fix warning
2017-10-30 20:46 [PATCH net-next] net: filter: remove unused variable and fix warning Jakub Kicinski
` (2 preceding siblings ...)
2017-10-30 21:56 ` Alexei Starovoitov
@ 2017-10-31 0:26 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-10-31 0:26 UTC (permalink / raw)
To: jakub.kicinski; +Cc: netdev, oss-drivers, alexei.starovoitov, daniel, brakmo
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Mon, 30 Oct 2017 13:46:47 -0700
> bpf_getsockopt bpf call sets the ret variable to zero and
> never changes it. What's worse in case CONFIG_INET is
> not selected the variable is completely unused generating
> a warning.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-31 0:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-30 20:46 [PATCH net-next] net: filter: remove unused variable and fix warning Jakub Kicinski
2017-10-30 21:13 ` Lawrence Brakmo
2017-10-30 21:55 ` Daniel Borkmann
2017-10-30 21:56 ` Alexei Starovoitov
2017-10-31 0:26 ` David Miller
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).