]> git.karo-electronics.de Git - karo-tx-linux.git/commit
lib/gcd.c: prevent possible div by 0
authorDavidlohr Bueso <dave@gnu.org>
Wed, 26 Sep 2012 01:34:28 +0000 (11:34 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 27 Sep 2012 07:27:57 +0000 (17:27 +1000)
commitfda32d77c75e8ea6efe0bf0ebba131d37d6d22e0
treeb5f9b5aebf24a1822dfebe7d7309487be12b47cf
parentd99ebb88137adfc55d09880427b832fcfc2530bd
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