* [PATCH linux-next] xfrm: Remove redundant fields
@ 2021-10-21 6:56 luo penghao
0 siblings, 0 replies; 4+ messages in thread
From: luo penghao @ 2021-10-21 6:56 UTC (permalink / raw)
To: SimonHorman
Cc: Steffen Klassert, Herbert Xu, David S . Miller, Jakub Kicinski,
netdev, linux-kernel, luo penghao, Zeal Robot
The variable err is not necessary in such places. It should be revmoved
for the simplicity of the code.
The clang_analyzer complains as follows:
net/xfrm/xfrm_input.c:533: warning:
net/xfrm/xfrm_input.c:563: warning:
Although the value stored to 'err' is used in the enclosing expression,
the value is never actually read from 'err'.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
---
net/xfrm/xfrm_input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 3df0861..70a8c36 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -530,7 +530,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
goto drop;
}
- if ((err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
+ if (xfrm_parse_spi(skb, nexthdr, &spi, &seq)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
goto drop;
}
@@ -560,7 +560,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
}
seq = 0;
- if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
+ if (!spi && xfrm_parse_spi(skb, nexthdr, &spi, &seq)) {
secpath_reset(skb);
XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
goto drop;
--
2.15.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH linux-next] xfrm: Remove redundant fields
2021-10-18 9:17 luo penghao
@ 2021-10-20 9:07 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2021-10-20 9:07 UTC (permalink / raw)
To: luo penghao
Cc: Steffen Klassert, Herbert Xu, David S . Miller, Jakub Kicinski,
netdev, linux-kernel, penghao luo, Zeal Robot
On Mon, Oct 18, 2021 at 09:17:58AM +0000, luo penghao wrote:
> From: penghao luo <luo.penghao@zte.com.cn>
>
> the variable err is not necessary in such places. It should be revmoved
> for the simplicity of the code.
>
> The clang_analyzer complains as follows:
>
> net/xfrm/xfrm_input.c:530: warning:
>
> Although the value stored to 'err' is used in the enclosing expression,
> the value is never actually read from 'err'.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: penghao luo <luo.penghao@zte.com.cn>
> ---
> net/xfrm/xfrm_input.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
> index 3df0861..ff34667 100644
> --- a/net/xfrm/xfrm_input.c
> +++ b/net/xfrm/xfrm_input.c
> @@ -530,7 +530,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
> goto drop;
> }
>
> - if ((err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
> + if ((xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
I agree that assigning the value to err is not needed.
But you may also wish to consider:
1. Dropping the () around the call to xfrm_parse_spi, which seem out of
place now.
2. Dropping the explicit check against zero
Which would leave you with:
if (xfrm_parse_spi(skb, nexthdr, &spi, &seq)) {
> XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
> goto drop;
> }
> @@ -560,7 +560,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
> }
>
> seq = 0;
> - if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
> + if (!spi && (xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
> secpath_reset(skb);
> XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
> goto drop;
> --
> 2.15.2
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH linux-next] xfrm: Remove redundant fields
@ 2021-10-18 9:17 luo penghao
2021-10-20 9:07 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: luo penghao @ 2021-10-18 9:17 UTC (permalink / raw)
To: Steffen Klassert
Cc: Herbert Xu, David S . Miller, Jakub Kicinski, netdev,
linux-kernel, penghao luo, Zeal Robot
From: penghao luo <luo.penghao@zte.com.cn>
the variable err is not necessary in such places. It should be revmoved
for the simplicity of the code.
The clang_analyzer complains as follows:
net/xfrm/xfrm_input.c:530: warning:
Although the value stored to 'err' is used in the enclosing expression,
the value is never actually read from 'err'.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: penghao luo <luo.penghao@zte.com.cn>
---
net/xfrm/xfrm_input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 3df0861..ff34667 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -530,7 +530,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
goto drop;
}
- if ((err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
+ if ((xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
goto drop;
}
@@ -560,7 +560,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
}
seq = 0;
- if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
+ if (!spi && (xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
secpath_reset(skb);
XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
goto drop;
--
2.15.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH linux-next] xfrm: Remove redundant fields
@ 2021-10-18 9:12 luo penghao
0 siblings, 0 replies; 4+ messages in thread
From: luo penghao @ 2021-10-18 9:12 UTC (permalink / raw)
To: Steffen Klassert
Cc: Herbert Xu, David S . Miller, Jakub Kicinski, netdev,
linux-kernel, penghao luo, Zeal Robot
From: penghao luo <luo.penghao@zte.com.cn>
the variable err is not necessary in such places. It should be revmoved
for the simplicity of the code.
The clang_analyzer complains as follows:
net/xfrm/xfrm_input.c:530: warning:
Although the value stored to 'err' is used in the enclosing expression,
the value is never actually read from 'err'.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: penghao luo <luo.penghao@zte.com.cn>
---
net/xfrm/xfrm_input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 3df0861..ff34667 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -530,7 +530,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
goto drop;
}
- if ((err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
+ if ((xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
goto drop;
}
@@ -560,7 +560,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
}
seq = 0;
- if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
+ if (!spi && (xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) {
secpath_reset(skb);
XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
goto drop;
--
2.15.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-21 6:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 6:56 [PATCH linux-next] xfrm: Remove redundant fields luo penghao
-- strict thread matches above, loose matches on Subject: below --
2021-10-18 9:17 luo penghao
2021-10-20 9:07 ` Simon Horman
2021-10-18 9:12 luo penghao
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.