From: Niu Yawei Date: Thu, 8 May 2014 02:38:53 +0000 (+0800) Subject: libquota: fix dict_uint_cmp() X-Git-Tag: v1.42.10~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4cf0b0fe443566940098308c2a9eb28fdb000166;p=thirdparty%2Fe2fsprogs.git libquota: fix dict_uint_cmp() dict_uint_cmp() returns an usigned int value in int type, which could mess the dict key comparison when the difference of two keys is greater than INT_MAX. Signed-off-by: Niu Yawei Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/quota/mkquota.c b/lib/quota/mkquota.c index 988321610..ba8c2da6a 100644 --- a/lib/quota/mkquota.c +++ b/lib/quota/mkquota.c @@ -207,7 +207,12 @@ static int dict_uint_cmp(const void *a, const void *b) c = VOIDPTR_TO_UINT(a); d = VOIDPTR_TO_UINT(b); - return c - d; + if (c == d) + return 0; + else if (c > d) + return 1; + else + return -1; } static inline qid_t get_qid(struct ext2_inode *inode, int qtype)