From: Rasmus Villemoes Date: Wed, 10 Dec 2014 23:54:37 +0000 (-0800) Subject: fs/hfs/catalog.c: fix comparison bug in hfs_cat_keycmp X-Git-Tag: omap-for-v3.19/fixes-rc1~142^2~18 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddbc22e27e672b6b180757ea1d7f8481dbb88128;p=pandora-kernel.git fs/hfs/catalog.c: fix comparison bug in hfs_cat_keycmp Relying on the sign (after casting to int) of the difference of two quantities for comparison is usually wrong. For example, should a-b turn out to be 2^31, the return value of cmp(a,b) is -2^31; but that would also be the return value from cmp(b, a). So a compares less than b and b compares less than a. One can also easily find three values a,b,c such that a compares less than b, b compares less than c, but a does not compare less than c. Signed-off-by: Rasmus Villemoes Reviewed-by: Vyacheslav Dubeyko Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed