All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] pktgen: Fix unsigned function that is returning negative vals
@ 2012-01-20  1:40 Paul Gortmaker
  2012-01-22 19:24 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Gortmaker @ 2012-01-20  1:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, Paul Gortmaker

Every call to num_args() immediately checks the return value for
less than zero, as it will return -EFAULT for a failed get_user()
call.  So it makes no sense for the function to be declared as an
unsigned long.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 65f80c7..4d8ce93 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -767,8 +767,8 @@ done:
 	return i;
 }
 
-static unsigned long num_arg(const char __user * user_buffer,
-			     unsigned long maxlen, unsigned long *num)
+static long num_arg(const char __user *user_buffer, unsigned long maxlen,
+				unsigned long *num)
 {
 	int i;
 	*num = 0;
-- 
1.7.7.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] pktgen: Fix unsigned function that is returning negative vals
  2012-01-20  1:40 [PATCH net-next] pktgen: Fix unsigned function that is returning negative vals Paul Gortmaker
@ 2012-01-22 19:24 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-01-22 19:24 UTC (permalink / raw)
  To: paul.gortmaker; +Cc: netdev

From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Thu, 19 Jan 2012 20:40:06 -0500

> Every call to num_args() immediately checks the return value for
> less than zero, as it will return -EFAULT for a failed get_user()
> call.  So it makes no sense for the function to be declared as an
> unsigned long.
> 
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-22 19:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20  1:40 [PATCH net-next] pktgen: Fix unsigned function that is returning negative vals Paul Gortmaker
2012-01-22 19:24 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.