git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sh: convert /proc/cpu/aligmnent, /proc/cpu/kernel_alignment to seq_file
[safe/jmp/linux-2.6]
/
net
/
ipv4
/
tcp_probe.c
diff --git
a/net/ipv4/tcp_probe.c
b/net/ipv4/tcp_probe.c
index
1c50959
..
59f5b5e
100644
(file)
--- a/
net/ipv4/tcp_probe.c
+++ b/
net/ipv4/tcp_probe.c
@@
-153,12
+153,11
@@
static int tcpprobe_sprint(char *tbuf, int n)
= ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start));
return snprintf(tbuf, n,
= ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start));
return snprintf(tbuf, n,
- "%lu.%09lu " NIPQUAD_FMT ":%u " NIPQUAD_FMT ":%u"
- " %d %#x %#x %u %u %u %u\n",
+ "%lu.%09lu %pI4:%u %pI4:%u %d %#x %#x %u %u %u %u\n",
(unsigned long) tv.tv_sec,
(unsigned long) tv.tv_nsec,
(unsigned long) tv.tv_sec,
(unsigned long) tv.tv_nsec,
-
NIPQUAD(p->saddr)
, ntohs(p->sport),
-
NIPQUAD(p->daddr)
, ntohs(p->dport),
+
&p->saddr
, ntohs(p->sport),
+
&p->daddr
, ntohs(p->dport),
p->length, p->snd_nxt, p->snd_una,
p->snd_cwnd, p->ssthresh, p->snd_wnd, p->srtt);
}
p->length, p->snd_nxt, p->snd_una,
p->snd_cwnd, p->ssthresh, p->snd_wnd, p->srtt);
}
@@
-166,9
+165,10
@@
static int tcpprobe_sprint(char *tbuf, int n)
static ssize_t tcpprobe_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos)
{
static ssize_t tcpprobe_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos)
{
- int error = 0, cnt = 0;
+ int error = 0;
+ size_t cnt = 0;
- if (!buf
|| len < 0
)
+ if (!buf)
return -EINVAL;
while (cnt < len) {
return -EINVAL;
while (cnt < len) {
@@
-190,19
+190,18
@@
static ssize_t tcpprobe_read(struct file *file, char __user *buf,
width = tcpprobe_sprint(tbuf, sizeof(tbuf));
width = tcpprobe_sprint(tbuf, sizeof(tbuf));
- if (width < len)
+ if (
cnt +
width < len)
tcp_probe.tail = (tcp_probe.tail + 1) % bufsize;
spin_unlock_bh(&tcp_probe.lock);
/* if record greater than space available
return partial buffer (so far) */
tcp_probe.tail = (tcp_probe.tail + 1) % bufsize;
spin_unlock_bh(&tcp_probe.lock);
/* if record greater than space available
return partial buffer (so far) */
- if (width >= len)
+ if (
cnt +
width >= len)
break;
break;
- error = copy_to_user(buf + cnt, tbuf, width);
- if (error)
- break;
+ if (copy_to_user(buf + cnt, tbuf, width))
+ return -EFAULT;
cnt += width;
}
cnt += width;
}
@@
-225,7
+224,7
@@
static __init int tcpprobe_init(void)
if (bufsize < 0)
return -EINVAL;
if (bufsize < 0)
return -EINVAL;
- tcp_probe.log = kcalloc(
sizeof(struct tcp_log), bufsize
, GFP_KERNEL);
+ tcp_probe.log = kcalloc(
bufsize, sizeof(struct tcp_log)
, GFP_KERNEL);
if (!tcp_probe.log)
goto err0;
if (!tcp_probe.log)
goto err0;