mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2025-01-19 15:03:24 +08:00
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 <yawei.niu@intel.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
4e2d9f7f4e
commit
4cf0b0fe44
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user