]> git.karo-electronics.de Git - karo-tx-linux.git/commit
lib/gcd.c: prevent possible div by 0
authorDavidlohr Bueso <dave@gnu.org>
Fri, 28 Sep 2012 00:20:25 +0000 (10:20 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 5 Oct 2012 04:01:25 +0000 (14:01 +1000)
commit8a578fc3fb933c06aee270f7a0642c86ff469954
tree39031e6f63f973d8293fc61ffcff9c21600b8892
parent5c198864e9ef1435ddaad5eeb6c7e19e4fb25a9e
lib/gcd.c: prevent possible div by 0

Account for all properties when a and/or b are 0:
gcd(0, 0) = 0
gcd(a, 0) = a
gcd(0, b) = b

Fixes no known problems in current kernels.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/gcd.c