]> 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>
Wed, 3 Oct 2012 06:50:46 +0000 (16:50 +1000)
commit66fd587d4e385747c55a02f5a99d6d79e6aa6daf
treee20332e1e45602acff3405ecf7f9e0d8812eae4a
parentd40ed7d2a5715c3a11169ffa906cbec5e3f93cee
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