Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49e31cba authored by Max Kellermann's avatar Max Kellermann Committed by Linus Torvalds
Browse files

[PATCH] sunrpc: print unsigned integers in stats



The sunrpc stats are collected in unsigned integers, but they are printed
with '%d'.  That can result in negative numbers in /proc/net/rpc when the
highest bit of a counter is set.  The following patch changes '%d' to '%u'
where appropriate.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7ea6040b
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -35,13 +35,13 @@ static int rpc_proc_show(struct seq_file *seq, void *v) {
	int		i, j;
	int		i, j;


	seq_printf(seq,
	seq_printf(seq,
		"net %d %d %d %d\n",
		"net %u %u %u %u\n",
			statp->netcnt,
			statp->netcnt,
			statp->netudpcnt,
			statp->netudpcnt,
			statp->nettcpcnt,
			statp->nettcpcnt,
			statp->nettcpconn);
			statp->nettcpconn);
	seq_printf(seq,
	seq_printf(seq,
		"rpc %d %d %d\n",
		"rpc %u %u %u\n",
			statp->rpccnt,
			statp->rpccnt,
			statp->rpcretrans,
			statp->rpcretrans,
			statp->rpcauthrefresh);
			statp->rpcauthrefresh);
@@ -50,10 +50,10 @@ static int rpc_proc_show(struct seq_file *seq, void *v) {
		const struct rpc_version *vers = prog->version[i];
		const struct rpc_version *vers = prog->version[i];
		if (!vers)
		if (!vers)
			continue;
			continue;
		seq_printf(seq, "proc%d %d",
		seq_printf(seq, "proc%u %u",
					vers->number, vers->nrprocs);
					vers->number, vers->nrprocs);
		for (j = 0; j < vers->nrprocs; j++)
		for (j = 0; j < vers->nrprocs; j++)
			seq_printf(seq, " %d",
			seq_printf(seq, " %u",
					vers->procs[j].p_count);
					vers->procs[j].p_count);
		seq_putc(seq, '\n');
		seq_putc(seq, '\n');
	}
	}
@@ -83,13 +83,13 @@ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) {
	int		i, j;
	int		i, j;


	seq_printf(seq,
	seq_printf(seq,
		"net %d %d %d %d\n",
		"net %u %u %u %u\n",
			statp->netcnt,
			statp->netcnt,
			statp->netudpcnt,
			statp->netudpcnt,
			statp->nettcpcnt,
			statp->nettcpcnt,
			statp->nettcpconn);
			statp->nettcpconn);
	seq_printf(seq,
	seq_printf(seq,
		"rpc %d %d %d %d %d\n",
		"rpc %u %u %u %u %u\n",
			statp->rpccnt,
			statp->rpccnt,
			statp->rpcbadfmt+statp->rpcbadauth+statp->rpcbadclnt,
			statp->rpcbadfmt+statp->rpcbadauth+statp->rpcbadclnt,
			statp->rpcbadfmt,
			statp->rpcbadfmt,
@@ -99,9 +99,9 @@ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) {
	for (i = 0; i < prog->pg_nvers; i++) {
	for (i = 0; i < prog->pg_nvers; i++) {
		if (!(vers = prog->pg_vers[i]) || !(proc = vers->vs_proc))
		if (!(vers = prog->pg_vers[i]) || !(proc = vers->vs_proc))
			continue;
			continue;
		seq_printf(seq, "proc%d %d", i, vers->vs_nproc);
		seq_printf(seq, "proc%d %u", i, vers->vs_nproc);
		for (j = 0; j < vers->vs_nproc; j++, proc++)
		for (j = 0; j < vers->vs_nproc; j++, proc++)
			seq_printf(seq, " %d", proc->pc_count);
			seq_printf(seq, " %u", proc->pc_count);
		seq_putc(seq, '\n');
		seq_putc(seq, '\n');
	}
	}
}
}