Skip to content

Commit

Permalink
bql: Fix POSDIFF() to integer overflow aware.
Browse files Browse the repository at this point in the history
POSDIFF() fails to take into account integer overflow case.

Signed-off-by: Hiroaki SHIMODA <[email protected]>
Cc: Tom Herbert <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Denys Fedoryshchenko <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
hiroa-ki authored and davem330 committed May 31, 2012
1 parent 401453a commit 0cfd32b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dynamic_queue_limits.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0cfd32b

Please sign in to comment.