* [PATCH 1/5 v2] netlink: Fix portid type in netlink_notify
@ 2015-04-09 21:57 Richard Weinberger
2015-04-09 21:57 ` [PATCH 2/5 v2] nfc: Fix portid type in urelease_work Richard Weinberger
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-04-09 21:57 UTC (permalink / raw)
To: netdev
Cc: linux-wireless, coreteam, netfilter-devel, linux-kernel, sameo,
aloisio.almeida, lauro.venancio, davem, kadlec, kaber, pablo,
Richard Weinberger
portid is an unsigned integer. Fix netlink_notify to
match all other portid user in the kernel.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
include/linux/netlink.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 02fc86d..6835c12 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -134,7 +134,7 @@ struct netlink_callback {
struct netlink_notify {
struct net *net;
- int portid;
+ u32 portid;
int protocol;
};
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5 v2] nfc: Fix portid type in urelease_work
2015-04-09 21:57 [PATCH 1/5 v2] netlink: Fix portid type in netlink_notify Richard Weinberger
@ 2015-04-09 21:57 ` Richard Weinberger
2015-04-09 21:57 ` [PATCH 3/5 v2] netfilter: Fix portid types Richard Weinberger
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-04-09 21:57 UTC (permalink / raw)
To: netdev
Cc: linux-wireless, coreteam, netfilter-devel, linux-kernel, sameo,
aloisio.almeida, lauro.venancio, davem, kadlec, kaber, pablo,
Richard Weinberger
portid is an unsigned integer. Fix urelease_work to
match all other portid user in the kernel.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
net/nfc/netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 14a2d11..3763036 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -1584,7 +1584,7 @@ static const struct genl_ops nfc_genl_ops[] = {
struct urelease_work {
struct work_struct w;
- int portid;
+ u32 portid;
};
static void nfc_urelease_event_work(struct work_struct *work)
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5 v2] netfilter: Fix portid types
2015-04-09 21:57 [PATCH 1/5 v2] netlink: Fix portid type in netlink_notify Richard Weinberger
2015-04-09 21:57 ` [PATCH 2/5 v2] nfc: Fix portid type in urelease_work Richard Weinberger
@ 2015-04-09 21:57 ` Richard Weinberger
2015-04-09 21:57 ` [PATCH 4/5 v2] netfilter: Fix format string of nfnetlink_queue proc file Richard Weinberger
2015-04-09 21:57 ` [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log " Richard Weinberger
3 siblings, 0 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-04-09 21:57 UTC (permalink / raw)
To: netdev
Cc: linux-wireless, coreteam, netfilter-devel, linux-kernel, sameo,
aloisio.almeida, lauro.venancio, davem, kadlec, kaber, pablo,
Richard Weinberger
The netlink portid is an unsigned integer, use this type
also in netfilter.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
net/netfilter/nfnetlink_log.c | 4 ++--
net/netfilter/nfnetlink_queue_core.c | 7 +++----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 11d85b3..7150d11 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -62,7 +62,7 @@ struct nfulnl_instance {
struct timer_list timer;
struct net *net;
struct user_namespace *peer_user_ns; /* User namespace of the peer process */
- int peer_portid; /* PORTID of the peer process */
+ u32 peer_portid; /* PORTID of the peer process */
/* configurable parameters */
unsigned int flushtimeout; /* timeout until queue flush */
@@ -151,7 +151,7 @@ static void nfulnl_timer(unsigned long data);
static struct nfulnl_instance *
instance_create(struct net *net, u_int16_t group_num,
- int portid, struct user_namespace *user_ns)
+ u32 portid, struct user_namespace *user_ns)
{
struct nfulnl_instance *inst;
struct nfnl_log_net *log = nfnl_log_pernet(net);
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 0db8515..0aba0b9 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -54,7 +54,7 @@ struct nfqnl_instance {
struct hlist_node hlist; /* global list of queues */
struct rcu_head rcu;
- int peer_portid;
+ u32 peer_portid;
unsigned int queue_maxlen;
unsigned int copy_range;
unsigned int queue_dropped;
@@ -109,8 +109,7 @@ instance_lookup(struct nfnl_queue_net *q, u_int16_t queue_num)
}
static struct nfqnl_instance *
-instance_create(struct nfnl_queue_net *q, u_int16_t queue_num,
- int portid)
+instance_create(struct nfnl_queue_net *q, u_int16_t queue_num, u32 portid)
{
struct nfqnl_instance *inst;
unsigned int h;
@@ -860,7 +859,7 @@ static const struct nla_policy nfqa_verdict_batch_policy[NFQA_MAX+1] = {
};
static struct nfqnl_instance *
-verdict_instance_lookup(struct nfnl_queue_net *q, u16 queue_num, int nlportid)
+verdict_instance_lookup(struct nfnl_queue_net *q, u16 queue_num, u32 nlportid)
{
struct nfqnl_instance *queue;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5 v2] netfilter: Fix format string of nfnetlink_queue proc file
2015-04-09 21:57 [PATCH 1/5 v2] netlink: Fix portid type in netlink_notify Richard Weinberger
2015-04-09 21:57 ` [PATCH 2/5 v2] nfc: Fix portid type in urelease_work Richard Weinberger
2015-04-09 21:57 ` [PATCH 3/5 v2] netfilter: Fix portid types Richard Weinberger
@ 2015-04-09 21:57 ` Richard Weinberger
2015-04-09 21:57 ` [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log " Richard Weinberger
3 siblings, 0 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-04-09 21:57 UTC (permalink / raw)
To: netdev
Cc: linux-wireless, coreteam, netfilter-devel, linux-kernel, sameo,
aloisio.almeida, lauro.venancio, davem, kadlec, kaber, pablo,
Richard Weinberger
The printed values are all of type unsigned integer, therefore use
%u instead of %d. Otherwise an user can face negative values.
Fixes:
$ cat /proc/net/netfilter/nfnetlink_queue
0 29508 278 2 65531 0 2004213241 -2129885586 1
1 -27747 0 2 65531 0 0 0 1
2 -27748 0 2 65531 0 0 0 1
Signed-off-by: Richard Weinberger <richard@nod.at>
---
net/netfilter/nfnetlink_queue_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 0aba0b9..017e3cd 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -1241,7 +1241,7 @@ static int seq_show(struct seq_file *s, void *v)
{
const struct nfqnl_instance *inst = v;
- seq_printf(s, "%5d %6d %5d %1d %5d %5d %5d %8d %2d\n",
+ seq_printf(s, "%5u %6u %5u %1u %5u %5u %5u %8u %2d\n",
inst->queue_num,
inst->peer_portid, inst->queue_total,
inst->copy_mode, inst->copy_range,
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log proc file
2015-04-09 21:57 [PATCH 1/5 v2] netlink: Fix portid type in netlink_notify Richard Weinberger
` (2 preceding siblings ...)
2015-04-09 21:57 ` [PATCH 4/5 v2] netfilter: Fix format string of nfnetlink_queue proc file Richard Weinberger
@ 2015-04-09 21:57 ` Richard Weinberger
2015-04-09 22:39 ` Joe Perches
3 siblings, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2015-04-09 21:57 UTC (permalink / raw)
To: netdev
Cc: linux-wireless, coreteam, netfilter-devel, linux-kernel, sameo,
aloisio.almeida, lauro.venancio, davem, kadlec, kaber, pablo,
Richard Weinberger
The printed values are all of type unsigned integer, therefore use
%u instead of %d. Otherwise an user can face negative values.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
net/netfilter/nfnetlink_log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 7150d11..313c26c 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -998,7 +998,7 @@ static int seq_show(struct seq_file *s, void *v)
{
const struct nfulnl_instance *inst = v;
- return seq_printf(s, "%5d %6d %5d %1d %5d %6d %2d\n",
+ return seq_printf(s, "%5u %6u %5u %1u %5u %6u %2u\n",
inst->group_num,
inst->peer_portid, inst->qlen,
inst->copy_mode, inst->copy_range,
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log proc file
2015-04-09 21:57 ` [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log " Richard Weinberger
@ 2015-04-09 22:39 ` Joe Perches
2015-04-09 22:43 ` Steven Rostedt
2015-04-10 7:31 ` Richard Weinberger
0 siblings, 2 replies; 9+ messages in thread
From: Joe Perches @ 2015-04-09 22:39 UTC (permalink / raw)
To: Richard Weinberger, Steven Rostedt
Cc: netdev, linux-wireless, coreteam, netfilter-devel, linux-kernel,
sameo, aloisio.almeida, lauro.venancio, davem, kadlec, kaber,
pablo
On Thu, 2015-04-09 at 23:57 +0200, Richard Weinberger wrote:
> The printed values are all of type unsigned integer, therefore use
> %u instead of %d. Otherwise an user can face negative values.
Hey Richard.
Just to clarify, this patch is for net and not for net-next
as net-next has removed the seq_printf return uses.
Are you going to submit an equivalent patch for net-next?
> diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
[]
> @@ -998,7 +998,7 @@ static int seq_show(struct seq_file *s, void *v)
> {
> const struct nfulnl_instance *inst = v;
>
> - return seq_printf(s, "%5d %6d %5d %1d %5d %6d %2d\n",
> + return seq_printf(s, "%5u %6u %5u %1u %5u %6u %2u\n",
> inst->group_num,
> inst->peer_portid, inst->qlen,
> inst->copy_mode, inst->copy_range,
And Steven,
commit e71456ae9871
("netfilter: Remove checks of seq_printf() return values")
mistakenly converted this to use seq_has_overflowed()
Ideally all seq_show functions would be converted from
int foo_seq_show(...)
{
seq_printf(s, ...);
return seq_has_overflowed(s);
}
to
int foo_seq_show(...)
{
seq_printf(s, ...);
return 0;
}
I made that mistake in a patch and corrected it later.
Here's a suggested -next patch:
Perhaps it shouldn't be submitted now as it may conflict
with what Richard might submit if he propses an equivalent
patch to above for -next.
There is an appropriate use of return seq_has_overflowed in:
net/netfilter/xt_hashlimit.c:825: return seq_has_overflowed(s);
That's not a seq_show function, it's a helper for one.
---
net/netfilter/nfnetlink_queue_core.c | 3 ++-
net/netfilter/x_tables.c | 11 +++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 6e74655..5f827a1 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -1248,7 +1248,8 @@ static int seq_show(struct seq_file *s, void *v)
inst->copy_mode, inst->copy_range,
inst->queue_dropped, inst->queue_user_dropped,
inst->id_sequence, 1);
- return seq_has_overflowed(s);
+
+ return 0;
}
static const struct seq_operations nfqnl_seq_ops = {
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 51a459c..4dcbea8 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -947,11 +947,10 @@ static int xt_table_seq_show(struct seq_file *seq, void *v)
{
struct xt_table *table = list_entry(v, struct xt_table, list);
- if (strlen(table->name)) {
+ if (strlen(table->name))
seq_printf(seq, "%s\n", table->name);
- return seq_has_overflowed(seq);
- } else
- return 0;
+
+ return 0;
}
static const struct seq_operations xt_table_seq_ops = {
@@ -1090,7 +1089,7 @@ static int xt_match_seq_show(struct seq_file *seq, void *v)
if (*match->name == '\0')
return 0;
seq_printf(seq, "%s\n", match->name);
- return seq_has_overflowed(seq);
+ break;
}
return 0;
}
@@ -1145,7 +1144,7 @@ static int xt_target_seq_show(struct seq_file *seq, void *v)
if (*target->name == '\0')
return 0;
seq_printf(seq, "%s\n", target->name);
- return seq_has_overflowed(seq);
+ break;
}
return 0;
}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log proc file
2015-04-09 22:39 ` Joe Perches
@ 2015-04-09 22:43 ` Steven Rostedt
2015-04-10 7:31 ` Richard Weinberger
1 sibling, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2015-04-09 22:43 UTC (permalink / raw)
To: Joe Perches
Cc: Richard Weinberger, netdev, linux-wireless, coreteam,
netfilter-devel, linux-kernel, sameo, aloisio.almeida,
lauro.venancio, davem, kadlec, kaber, pablo
On Thu, 09 Apr 2015 15:39:37 -0700
Joe Perches <joe@perches.com> wrote:
> And Steven,
>
> commit e71456ae9871
> ("netfilter: Remove checks of seq_printf() return values")
> mistakenly converted this to use seq_has_overflowed()
>
> Ideally all seq_show functions would be converted from
>
> int foo_seq_show(...)
> {
> seq_printf(s, ...);
> return seq_has_overflowed(s);
> }
>
> to
>
> int foo_seq_show(...)
> {
> seq_printf(s, ...);
> return 0;
> }
>
> I made that mistake in a patch and corrected it later.
>
> Here's a suggested -next patch:
>
> Perhaps it shouldn't be submitted now as it may conflict
> with what Richard might submit if he propses an equivalent
> patch to above for -next.
>
> There is an appropriate use of return seq_has_overflowed in:
>
> net/netfilter/xt_hashlimit.c:825: return seq_has_overflowed(s);
>
> That's not a seq_show function, it's a helper for one.
I have other things to work on, so feel free to fix it up among
yourselves.
-- Steve
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log proc file
2015-04-09 22:39 ` Joe Perches
2015-04-09 22:43 ` Steven Rostedt
@ 2015-04-10 7:31 ` Richard Weinberger
2015-04-10 19:40 ` David Miller
1 sibling, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2015-04-10 7:31 UTC (permalink / raw)
To: Joe Perches, Steven Rostedt
Cc: netdev, linux-wireless, coreteam, netfilter-devel, linux-kernel,
sameo, aloisio.almeida, lauro.venancio, davem, kadlec, kaber,
pablo
Am 10.04.2015 um 00:39 schrieb Joe Perches:
> On Thu, 2015-04-09 at 23:57 +0200, Richard Weinberger wrote:
>> The printed values are all of type unsigned integer, therefore use
>> %u instead of %d. Otherwise an user can face negative values.
>
> Hey Richard.
>
> Just to clarify, this patch is for net and not for net-next
> as net-next has removed the seq_printf return uses.
>
> Are you going to submit an equivalent patch for net-next?
Hmm, you are right. It took me a few minutes to figure out what happened
because I did rebase my patches to net-next and fixed up 5/5 already.
Reading yesterday's bash history shows that I've used
git format-patch in a wrong way such that the comments from the old
branch were taken.
Thanks,
//richard
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log proc file
2015-04-10 7:31 ` Richard Weinberger
@ 2015-04-10 19:40 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2015-04-10 19:40 UTC (permalink / raw)
To: richard
Cc: joe, rostedt, netdev, linux-wireless, coreteam, netfilter-devel,
linux-kernel, sameo, aloisio.almeida, lauro.venancio, kadlec,
kaber, pablo
From: Richard Weinberger <richard@nod.at>
Date: Fri, 10 Apr 2015 09:31:19 +0200
> Am 10.04.2015 um 00:39 schrieb Joe Perches:
>> On Thu, 2015-04-09 at 23:57 +0200, Richard Weinberger wrote:
>>> The printed values are all of type unsigned integer, therefore use
>>> %u instead of %d. Otherwise an user can face negative values.
>>
>> Hey Richard.
>>
>> Just to clarify, this patch is for net and not for net-next
>> as net-next has removed the seq_printf return uses.
>>
>> Are you going to submit an equivalent patch for net-next?
>
> Hmm, you are right. It took me a few minutes to figure out what happened
> because I did rebase my patches to net-next and fixed up 5/5 already.
> Reading yesterday's bash history shows that I've used
> git format-patch in a wrong way such that the comments from the old
> branch were taken.
I'm waiting for you to respin this series against net-next, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-04-10 19:40 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-09 21:57 [PATCH 1/5 v2] netlink: Fix portid type in netlink_notify Richard Weinberger
2015-04-09 21:57 ` [PATCH 2/5 v2] nfc: Fix portid type in urelease_work Richard Weinberger
2015-04-09 21:57 ` [PATCH 3/5 v2] netfilter: Fix portid types Richard Weinberger
2015-04-09 21:57 ` [PATCH 4/5 v2] netfilter: Fix format string of nfnetlink_queue proc file Richard Weinberger
2015-04-09 21:57 ` [PATCH 5/5 v2] netfilter: Fix format string of nfnetlink_log " Richard Weinberger
2015-04-09 22:39 ` Joe Perches
2015-04-09 22:43 ` Steven Rostedt
2015-04-10 7:31 ` Richard Weinberger
2015-04-10 19:40 ` 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).