* [PATCH 4/9 net-next] ipv6: replace if/BUG by BUG_ON
[not found] <1427749998-28464-1-git-send-email-fabf@skynet.be>
@ 2015-03-30 21:13 ` Fabian Frederick
2015-03-31 3:50 ` YOSHIFUJI Hideaki
2015-03-30 21:13 ` [PATCH 9/9 net-next] netfilter: " Fabian Frederick
1 sibling, 1 reply; 5+ messages in thread
From: Fabian Frederick @ 2015-03-30 21:13 UTC (permalink / raw)
To: linux-kernel
Cc: Fabian Frederick, David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Steffen Klassert, Herbert Xu,
Pablo Neira Ayuso, Jozsef Kadlecsik, netdev, netfilter-devel,
coreteam
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
net/ipv6/addrconf.c | 3 +--
net/ipv6/esp6.c | 3 +--
net/ipv6/netfilter/nf_conntrack_reasm.c | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2660263..e205918 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4805,8 +4805,7 @@ static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
if (!idev)
return -EAFNOSUPPORT;
- if (nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0)
- BUG();
+ BUG_ON(nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0);
if (tb[IFLA_INET6_TOKEN]) {
err = inet6_set_iftoken(idev, nla_data(tb[IFLA_INET6_TOKEN]));
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index e48f2c7..9e51b69 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -280,8 +280,7 @@ static int esp_input_done2(struct sk_buff *skb, int err)
if (unlikely(err))
goto out;
- if (skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2))
- BUG();
+ BUG_ON(skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2));
err = -EINVAL;
padlen = nexthdr[0];
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 6f187c8..cea1a4a 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -538,8 +538,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
pr_debug("too short\n");
return -1;
}
- if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
- BUG();
+ BUG_ON(skb_copy_bits(skb, start, &hdr, sizeof(hdr)));
if (nexthdr == NEXTHDR_AUTH)
hdrlen = (hdr.hdrlen+2)<<2;
else
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 9/9 net-next] netfilter: replace if/BUG by BUG_ON
[not found] <1427749998-28464-1-git-send-email-fabf@skynet.be>
2015-03-30 21:13 ` [PATCH 4/9 net-next] ipv6: replace if/BUG by BUG_ON Fabian Frederick
@ 2015-03-30 21:13 ` Fabian Frederick
1 sibling, 0 replies; 5+ messages in thread
From: Fabian Frederick @ 2015-03-30 21:13 UTC (permalink / raw)
To: linux-kernel
Cc: Fabian Frederick, Pablo Neira Ayuso, Patrick McHardy,
Jozsef Kadlecsik, David S. Miller, netfilter-devel, coreteam,
netdev
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
net/netfilter/nfnetlink_log.c | 3 +--
net/netfilter/xt_u32.c | 8 +++-----
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 957b83a..409f5fb 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -577,8 +577,7 @@ __build_packet_message(struct nfnl_log_net *log,
nla->nla_type = NFULA_PAYLOAD;
nla->nla_len = size;
- if (skb_copy_bits(skb, 0, nla_data(nla), data_len))
- BUG();
+ BUG_ON(skb_copy_bits(skb, 0, nla_data(nla), data_len));
}
nlh->nlmsg_len = inst->skb->tail - old_tail;
diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c
index a95b5034..5ff937d 100644
--- a/net/netfilter/xt_u32.c
+++ b/net/netfilter/xt_u32.c
@@ -38,8 +38,7 @@ static bool u32_match_it(const struct xt_u32 *data,
if (skb->len < 4 || pos > skb->len - 4)
return false;
- if (skb_copy_bits(skb, pos, &n, sizeof(n)) < 0)
- BUG();
+ BUG_ON(skb_copy_bits(skb, pos, &n, sizeof(n)) < 0);
val = ntohl(n);
nnums = ct->nnums;
@@ -65,9 +64,8 @@ static bool u32_match_it(const struct xt_u32 *data,
pos > skb->len - at - 4)
return false;
- if (skb_copy_bits(skb, at + pos, &n,
- sizeof(n)) < 0)
- BUG();
+ BUG_ON(skb_copy_bits(skb, at + pos, &n,
+ sizeof(n)) < 0);
val = ntohl(n);
break;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 4/9 net-next] ipv6: replace if/BUG by BUG_ON
2015-03-30 21:13 ` [PATCH 4/9 net-next] ipv6: replace if/BUG by BUG_ON Fabian Frederick
@ 2015-03-31 3:50 ` YOSHIFUJI Hideaki
2015-03-31 15:17 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: YOSHIFUJI Hideaki @ 2015-03-31 3:50 UTC (permalink / raw)
To: Fabian Frederick, linux-kernel
Cc: hideaki.yoshifuji, David S. Miller, Alexey Kuznetsov,
James Morris, Hideaki YOSHIFUJI, Patrick McHardy,
Steffen Klassert, Herbert Xu, Pablo Neira Ayuso, Jozsef Kadlecsik,
netdev, netfilter-devel, coreteam
Hi,
Fabian Frederick wrote:
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> net/ipv6/addrconf.c | 3 +--
> net/ipv6/esp6.c | 3 +--
> net/ipv6/netfilter/nf_conntrack_reasm.c | 3 +--
> 3 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 2660263..e205918 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -4805,8 +4805,7 @@ static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
> if (!idev)
> return -EAFNOSUPPORT;
>
> - if (nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0)
> - BUG();
> + BUG_ON(nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0);
>
NACK, I do not prefer using BUG_ON() with side effects.
--yoshfuji
> if (tb[IFLA_INET6_TOKEN]) {
> err = inet6_set_iftoken(idev, nla_data(tb[IFLA_INET6_TOKEN]));
> diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
> index e48f2c7..9e51b69 100644
> --- a/net/ipv6/esp6.c
> +++ b/net/ipv6/esp6.c
> @@ -280,8 +280,7 @@ static int esp_input_done2(struct sk_buff *skb, int err)
> if (unlikely(err))
> goto out;
>
> - if (skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2))
> - BUG();
> + BUG_ON(skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2));
>
> err = -EINVAL;
> padlen = nexthdr[0];
> diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
> index 6f187c8..cea1a4a 100644
> --- a/net/ipv6/netfilter/nf_conntrack_reasm.c
> +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
> @@ -538,8 +538,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
> pr_debug("too short\n");
> return -1;
> }
> - if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
> - BUG();
> + BUG_ON(skb_copy_bits(skb, start, &hdr, sizeof(hdr)));
> if (nexthdr == NEXTHDR_AUTH)
> hdrlen = (hdr.hdrlen+2)<<2;
> else
>
--
Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com>
Technical Division, MIRACLE LINUX CORPORATION
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4/9 net-next] ipv6: replace if/BUG by BUG_ON
2015-03-31 3:50 ` YOSHIFUJI Hideaki
@ 2015-03-31 15:17 ` David Miller
2015-04-03 20:02 ` Fabian Frederick
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2015-03-31 15:17 UTC (permalink / raw)
To: hideaki.yoshifuji
Cc: fabf, linux-kernel, kuznet, jmorris, yoshfuji, kaber,
steffen.klassert, herbert, pablo, kadlec, netdev, netfilter-devel,
coreteam
From: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
Date: Tue, 31 Mar 2015 12:50:27 +0900
> Hi,
>
> Fabian Frederick wrote:
>> Signed-off-by: Fabian Frederick <fabf@skynet.be>
>> ---
>> net/ipv6/addrconf.c | 3 +--
>> net/ipv6/esp6.c | 3 +--
>> net/ipv6/netfilter/nf_conntrack_reasm.c | 3 +--
>> 3 files changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>> index 2660263..e205918 100644
>> --- a/net/ipv6/addrconf.c
>> +++ b/net/ipv6/addrconf.c
>> @@ -4805,8 +4805,7 @@ static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
>> if (!idev)
>> return -EAFNOSUPPORT;
>>
>> - if (nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0)
>> - BUG();
>> + BUG_ON(nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0);
>>
>
> NACK, I do not prefer using BUG_ON() with side effects.
Agreed, I do not like these changes at all and will not be
applying them.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4/9 net-next] ipv6: replace if/BUG by BUG_ON
2015-03-31 15:17 ` David Miller
@ 2015-04-03 20:02 ` Fabian Frederick
0 siblings, 0 replies; 5+ messages in thread
From: Fabian Frederick @ 2015-04-03 20:02 UTC (permalink / raw)
To: hideaki.yoshifuji, David Miller
Cc: pablo, coreteam, herbert, netdev, linux-kernel, yoshfuji,
netfilter-devel, steffen.klassert, jmorris, kuznet, kadlec, kaber
> On 31 March 2015 at 17:17 David Miller <davem@davemloft.net> wrote:
>
>
> From: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
> Date: Tue, 31 Mar 2015 12:50:27 +0900
>
> > Hi,
> >
> > Fabian Frederick wrote:
> >> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> >> ---
> >> net/ipv6/addrconf.c | 3 +--
> >> net/ipv6/esp6.c | 3 +--
> >> net/ipv6/netfilter/nf_conntrack_reasm.c | 3 +--
> >> 3 files changed, 3 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> >> index 2660263..e205918 100644
> >> --- a/net/ipv6/addrconf.c
> >> +++ b/net/ipv6/addrconf.c
> >> @@ -4805,8 +4805,7 @@ static int inet6_set_link_af(struct net_device *dev,
> >> const struct nlattr *nla)
> >> if (!idev)
> >> return -EAFNOSUPPORT;
> >>
> >> - if (nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0)
> >> - BUG();
> >> + BUG_ON(nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0);
> >>
> >
> > NACK, I do not prefer using BUG_ON() with side effects.
>
> Agreed, I do not like these changes at all and will not be
> applying them.
I guess patches like these should be reverted then ?
e3f0b86b996d
"ipv6: Use BUG_ON"
8242fc33925c
"net: ipv6: Use BUG_ON"
Some existing BUG_ON() as well ? ; eg second one in net/decnet/dn_rules.c:
void __init dn_fib_rules_init(void)
{
dn_fib_rules_ops =
fib_rules_register(&dn_fib_rules_ops_template, &init_net);
BUG_ON(IS_ERR(dn_fib_rules_ops));
BUG_ON(fib_default_rule_add(dn_fib_rules_ops, 0x7fff,
RT_TABLE_MAIN, 0));
}
Regards,
Fabian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-03 20:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1427749998-28464-1-git-send-email-fabf@skynet.be>
2015-03-30 21:13 ` [PATCH 4/9 net-next] ipv6: replace if/BUG by BUG_ON Fabian Frederick
2015-03-31 3:50 ` YOSHIFUJI Hideaki
2015-03-31 15:17 ` David Miller
2015-04-03 20:02 ` Fabian Frederick
2015-03-30 21:13 ` [PATCH 9/9 net-next] netfilter: " Fabian Frederick
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).