* [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr
@ 2020-11-06 6:42 menglong8.dong
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_dump_one menglong8.dong
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: menglong8.dong @ 2020-11-06 6:42 UTC (permalink / raw)
To: kuba; +Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
From: Menglong Dong <dong.menglong@zte.com.cn>
The initialization for 'err' with '-EINVAL' is redundant and
can be removed, as it is updated soon.
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
---
net/ipv4/devinet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 123a6d3..847cb18 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -651,7 +651,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh,
struct ifaddrmsg *ifm;
struct in_ifaddr *ifa;
- int err = -EINVAL;
+ int err;
ASSERT_RTNL();
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] net: udp: remove redundant initialization in udp_dump_one
2020-11-06 6:42 [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr menglong8.dong
@ 2020-11-06 6:42 ` menglong8.dong
2020-11-10 1:13 ` Jakub Kicinski
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_gro_complete menglong8.dong
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: menglong8.dong @ 2020-11-06 6:42 UTC (permalink / raw)
To: kuba; +Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
From: Menglong Dong <dong.menglong@zte.com.cn>
The initialization for 'err' with '-EINVAL' is redundant and
can be removed, as it is updated soon and not used.
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
---
net/ipv4/udp_diag.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 1dbece3..b2cee9a 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -30,7 +30,7 @@ static int udp_dump_one(struct udp_table *tbl,
const struct inet_diag_req_v2 *req)
{
struct sk_buff *in_skb = cb->skb;
- int err = -EINVAL;
+ int err;
struct sock *sk = NULL;
struct sk_buff *rep;
struct net *net = sock_net(in_skb->sk);
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] net: udp: remove redundant initialization in udp_gro_complete
2020-11-06 6:42 [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr menglong8.dong
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_dump_one menglong8.dong
@ 2020-11-06 6:42 ` menglong8.dong
2020-11-09 18:28 ` Jakub Kicinski
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_send_skb menglong8.dong
2020-11-07 23:48 ` [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr Jakub Kicinski
3 siblings, 1 reply; 9+ messages in thread
From: menglong8.dong @ 2020-11-06 6:42 UTC (permalink / raw)
To: kuba; +Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
From: Menglong Dong <dong.menglong@zte.com.cn>
The initialization for 'err' with '-ENOSYS' is redundant and
can be removed, as it is updated soon and not used.
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
---
net/ipv4/udp_offload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index b8b1fde..65860f8 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -554,7 +554,7 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff,
{
__be16 newlen = htons(skb->len - nhoff);
struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
- int err = -ENOSYS;
+ int err;
struct sock *sk;
uh->len = newlen;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] net: udp: remove redundant initialization in udp_send_skb
2020-11-06 6:42 [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr menglong8.dong
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_dump_one menglong8.dong
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_gro_complete menglong8.dong
@ 2020-11-06 6:42 ` menglong8.dong
2020-11-10 1:13 ` Jakub Kicinski
2020-11-07 23:48 ` [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr Jakub Kicinski
3 siblings, 1 reply; 9+ messages in thread
From: menglong8.dong @ 2020-11-06 6:42 UTC (permalink / raw)
To: kuba; +Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
From: Menglong Dong <dong.menglong@zte.com.cn>
The initialization for 'err' with 0 is redundant and can be removed,
as it is updated by ip_send_skb and not used before that.
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
---
net/ipv4/udp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ca04a8a..6953688 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -874,7 +874,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
struct sock *sk = skb->sk;
struct inet_sock *inet = inet_sk(sk);
struct udphdr *uh;
- int err = 0;
+ int err;
int is_udplite = IS_UDPLITE(sk);
int offset = skb_transport_offset(skb);
int len = skb->len - offset;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr
2020-11-06 6:42 [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr menglong8.dong
` (2 preceding siblings ...)
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_send_skb menglong8.dong
@ 2020-11-07 23:48 ` Jakub Kicinski
2020-11-08 0:42 ` Menglong Dong
3 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2020-11-07 23:48 UTC (permalink / raw)
To: menglong8.dong
Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
On Fri, 6 Nov 2020 01:42:37 -0500 menglong8.dong@gmail.com wrote:
> From: Menglong Dong <dong.menglong@zte.com.cn>
>
> The initialization for 'err' with '-EINVAL' is redundant and
> can be removed, as it is updated soon.
>
> Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
How many changes like this are there in the kernel right now?
I'm afraid that if there are too many it's not worth the effort.
Also - what tool do you use to find those, we need to make sure new
instances don't get into the tree.
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 123a6d3..847cb18 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -651,7 +651,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh,
> struct ifaddrmsg *ifm;
> struct in_ifaddr *ifa;
>
You can remove this empty line while at it.
> - int err = -EINVAL;
> + int err;
>
> ASSERT_RTNL();
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr
2020-11-07 23:48 ` [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr Jakub Kicinski
@ 2020-11-08 0:42 ` Menglong Dong
0 siblings, 0 replies; 9+ messages in thread
From: Menglong Dong @ 2020-11-08 0:42 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
Dear Jakub,
On Sun, Nov 8, 2020 at 7:48 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 6 Nov 2020 01:42:37 -0500 menglong8.dong@gmail.com wrote:
> > From: Menglong Dong <dong.menglong@zte.com.cn>
> >
> > The initialization for 'err' with '-EINVAL' is redundant and
> > can be removed, as it is updated soon.
> >
> > Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
>
> How many changes like this are there in the kernel right now?
>
> I'm afraid that if there are too many it's not worth the effort.
>
> Also - what tool do you use to find those, we need to make sure new
> instances don't get into the tree.
>
I didn't use any tools. Maybe some general tools, such as kw,
coverity, coccicheck,
are able to find these changes(as far as I know, they can).
In fact, I find these changes by my eyes. I believe 'err' is the most
likely victim
and checked every usage of it in 'net' directory. Here are all the
changes I found,
and I think there won't be too many.
Cheers,
Menglong Dong
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: udp: remove redundant initialization in udp_gro_complete
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_gro_complete menglong8.dong
@ 2020-11-09 18:28 ` Jakub Kicinski
0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2020-11-09 18:28 UTC (permalink / raw)
To: menglong8.dong
Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
On Fri, 6 Nov 2020 01:42:39 -0500 menglong8.dong@gmail.com wrote:
> {
> __be16 newlen = htons(skb->len - nhoff);
> struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
> - int err = -ENOSYS;
> + int err;
> struct sock *sk;
You can also move the err declaration below struct sock *sk; to get
this closer to revert xmas tree order. In other patches it'd increase
change / potential conflict radius but here the correct position is
close enough so we can move.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: udp: remove redundant initialization in udp_send_skb
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_send_skb menglong8.dong
@ 2020-11-10 1:13 ` Jakub Kicinski
0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2020-11-10 1:13 UTC (permalink / raw)
To: menglong8.dong
Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
On Fri, 6 Nov 2020 01:42:40 -0500 menglong8.dong@gmail.com wrote:
> From: Menglong Dong <dong.menglong@zte.com.cn>
>
> The initialization for 'err' with 0 is redundant and can be removed,
> as it is updated by ip_send_skb and not used before that.
>
> Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: udp: remove redundant initialization in udp_dump_one
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_dump_one menglong8.dong
@ 2020-11-10 1:13 ` Jakub Kicinski
0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2020-11-10 1:13 UTC (permalink / raw)
To: menglong8.dong
Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, Menglong Dong
On Fri, 6 Nov 2020 01:42:38 -0500 menglong8.dong@gmail.com wrote:
> From: Menglong Dong <dong.menglong@zte.com.cn>
>
> The initialization for 'err' with '-EINVAL' is redundant and
> can be removed, as it is updated soon and not used.
>
> Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
Applied, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-11-10 1:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 6:42 [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr menglong8.dong
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_dump_one menglong8.dong
2020-11-10 1:13 ` Jakub Kicinski
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_gro_complete menglong8.dong
2020-11-09 18:28 ` Jakub Kicinski
2020-11-06 6:42 ` [PATCH] net: udp: remove redundant initialization in udp_send_skb menglong8.dong
2020-11-10 1:13 ` Jakub Kicinski
2020-11-07 23:48 ` [PATCH] net: ipv4: remove redundant initialization in inet_rtm_deladdr Jakub Kicinski
2020-11-08 0:42 ` Menglong Dong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.