Skip to content

Commit 0cfd32b

Browse files
hiroa-kidavem330
authored andcommitted
bql: Fix POSDIFF() to integer overflow aware.
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]>
1 parent 401453a commit 0cfd32b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/dynamic_queue_limits.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <linux/jiffies.h>
1111
#include <linux/dynamic_queue_limits.h>
1212

13-
#define POSDIFF(A, B) ((A) > (B) ? (A) - (B) : 0)
13+
#define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0)
1414

1515
/* Records completed count and recalculates the queue limit */
1616
void dql_completed(struct dql *dql, unsigned int count)

0 commit comments

Comments
 (0)