Message ID | 20120531072439.6c634a0b.shimoda.hiroaki@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, 2012-05-31 at 07:24 +0900, Hiroaki SHIMODA wrote: > POSDIFF() fails to take into account integer overflow case. > > Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com> > Cc: Tom Herbert <therbert@google.com> > Cc: Eric Dumazet <eric.dumazet@gmail.com> > Cc: Denys Fedoryshchenko <denys@visp.net.lb> > --- > lib/dynamic_queue_limits.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c > index 6ab4587..c87eb76 100644 > --- a/lib/dynamic_queue_limits.c > +++ b/lib/dynamic_queue_limits.c > @@ -10,7 +10,7 @@ > #include <linux/jiffies.h> > #include <linux/dynamic_queue_limits.h> > > -#define POSDIFF(A, B) ((A) > (B) ? (A) - (B) : 0) > +#define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0) > > /* Records completed count and recalculates the queue limit */ > void dql_completed(struct dql *dql, unsigned int count) Acked-by: Eric Dumazet <edumazet@google.com> -- 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
From: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com> Date: Thu, 31 May 2012 07:24:39 +0900 > POSDIFF() fails to take into account integer overflow case. > > Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com> Applied and queued up for -stable. -- 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
diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c index 6ab4587..c87eb76 100644 --- a/lib/dynamic_queue_limits.c +++ b/lib/dynamic_queue_limits.c @@ -10,7 +10,7 @@ #include <linux/jiffies.h> #include <linux/dynamic_queue_limits.h> -#define POSDIFF(A, B) ((A) > (B) ? (A) - (B) : 0) +#define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0) /* Records completed count and recalculates the queue limit */ void dql_completed(struct dql *dql, unsigned int count)
POSDIFF() fails to take into account integer overflow case. Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com> Cc: Tom Herbert <therbert@google.com> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Denys Fedoryshchenko <denys@visp.net.lb> --- lib/dynamic_queue_limits.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)