Patchwork ax25: proc uid file misses header

login
register
mail settings
Submitter Alan Cox
Date April 17, 2009, 2:19 p.m.
Message ID <20090417141928.15105.59684.stgit@t61.ukuu.org.uk>
Download mbox | patch
Permalink /patch/26121/
State Accepted
Delegated to: David Miller
Headers show

Comments

Alan Cox - April 17, 2009, 2:19 p.m.
This has been broken for a while. I happened to catch it testing because one
app "knew" that the top line of the calls data was the policy line and got
confused.

Put the header back.

Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
---

 net/ax25/ax25_uid.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - April 20, 2009, 9:15 a.m.
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date: Fri, 17 Apr 2009 15:19:36 +0100

> This has been broken for a while. I happened to catch it testing because one
> app "knew" that the top line of the calls data was the policy line and got
> confused.
> 
> Put the header back.
> 
> Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>

Applied, thanks.

I had to fixup some trailing whitespace bits, however.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index 57aeba7..d5cfbcf 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -148,9 +148,13 @@  static void *ax25_uid_seq_start(struct seq_file *seq, loff_t *pos)
 {
 	struct ax25_uid_assoc *pt;
 	struct hlist_node *node;
-	int i = 0;
+	int i = 1;
 
 	read_lock(&ax25_uid_lock);
+	
+	if (*pos == 0)
+		return SEQ_START_TOKEN;
+
 	ax25_uid_for_each(pt, node, &ax25_uid_list) {
 		if (i == *pos)
 			return pt;
@@ -162,8 +166,10 @@  static void *ax25_uid_seq_start(struct seq_file *seq, loff_t *pos)
 static void *ax25_uid_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
 	++*pos;
-
-	return hlist_entry(((ax25_uid_assoc *)v)->uid_node.next,
+	if (v == SEQ_START_TOKEN)
+		return ax25_uid_list.first;
+	else
+		return hlist_entry(((ax25_uid_assoc *)v)->uid_node.next,
 			   ax25_uid_assoc, uid_node);
 }