Commit 0cfd32b7 authored by Hiroaki SHIMODA's avatar Hiroaki SHIMODA Committed by David S. Miller

bql: Fix POSDIFF() to integer overflow aware.

POSDIFF() fails to take into account integer overflow case.
Signed-off-by: default avatarHiroaki 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>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 401453a3
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment