* [PATCH 1/1 net-next] esp4: remove assignment in if condition
@ 2014-11-04 19:28 Fabian Frederick
2014-11-04 19:33 ` Joe Perches
2014-11-04 19:42 ` Daniel Borkmann
0 siblings, 2 replies; 4+ messages in thread
From: Fabian Frederick @ 2014-11-04 19:28 UTC (permalink / raw)
To: linux-kernel
Cc: Fabian Frederick, Steffen Klassert, Herbert Xu, David S. Miller,
Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, netdev
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
net/ipv4/esp4.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 360b565..9dd66ee 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -392,8 +392,11 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
if (elen <= 0)
goto out;
- if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
+ err = skb_cow_data(skb, 0, &trailer);
+
+ if (err < 0)
goto out;
+
nfrags = err;
assoclen = sizeof(*esph);
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1 net-next] esp4: remove assignment in if condition
2014-11-04 19:28 [PATCH 1/1 net-next] esp4: remove assignment in if condition Fabian Frederick
@ 2014-11-04 19:33 ` Joe Perches
2014-11-04 20:07 ` David Miller
2014-11-04 19:42 ` Daniel Borkmann
1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2014-11-04 19:33 UTC (permalink / raw)
To: Fabian Frederick
Cc: linux-kernel, Steffen Klassert, Herbert Xu, David S. Miller,
Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, netdev
On Tue, 2014-11-04 at 20:28 +0100, Fabian Frederick wrote:
trivia:
> diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
[]
> @@ -392,8 +392,11 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
> if (elen <= 0)
> goto out;
>
> - if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
> + err = skb_cow_data(skb, 0, &trailer);
> +
> + if (err < 0)
> goto out;
Generally it's better/more common to use
foo = bar();
if (!foo)
[error_handler...]
without the blank line between the set
and the test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1 net-next] esp4: remove assignment in if condition
2014-11-04 19:28 [PATCH 1/1 net-next] esp4: remove assignment in if condition Fabian Frederick
2014-11-04 19:33 ` Joe Perches
@ 2014-11-04 19:42 ` Daniel Borkmann
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2014-11-04 19:42 UTC (permalink / raw)
To: Fabian Frederick
Cc: linux-kernel, Steffen Klassert, Herbert Xu, David S. Miller,
Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, netdev
On 11/04/2014 08:28 PM, Fabian Frederick wrote:
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> net/ipv4/esp4.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
> index 360b565..9dd66ee 100644
> --- a/net/ipv4/esp4.c
> +++ b/net/ipv4/esp4.c
> @@ -392,8 +392,11 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
> if (elen <= 0)
> goto out;
>
> - if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
> + err = skb_cow_data(skb, 0, &trailer);
> +
If you already feel the need to change this (?), then please don't
add an extra newline here ...
> + if (err < 0)
> goto out;
> +
> nfrags = err;
>
> assoclen = sizeof(*esph);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1 net-next] esp4: remove assignment in if condition
2014-11-04 19:33 ` Joe Perches
@ 2014-11-04 20:07 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-11-04 20:07 UTC (permalink / raw)
To: joe
Cc: fabf, linux-kernel, steffen.klassert, herbert, kuznet, jmorris,
yoshfuji, kaber, netdev
From: Joe Perches <joe@perches.com>
Date: Tue, 04 Nov 2014 11:33:51 -0800
> On Tue, 2014-11-04 at 20:28 +0100, Fabian Frederick wrote:
>
> trivia:
>
>> diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
> []
>> @@ -392,8 +392,11 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
>> if (elen <= 0)
>> goto out;
>>
>> - if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
>> + err = skb_cow_data(skb, 0, &trailer);
>> +
>> + if (err < 0)
>> goto out;
>
> Generally it's better/more common to use
>
> foo = bar();
> if (!foo)
> [error_handler...]
>
> without the blank line between the set
> and the test.
+1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-04 20:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-04 19:28 [PATCH 1/1 net-next] esp4: remove assignment in if condition Fabian Frederick
2014-11-04 19:33 ` Joe Perches
2014-11-04 20:07 ` David Miller
2014-11-04 19:42 ` Daniel Borkmann
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).