summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2015-01-15 11:30:54 +1100
committerJames Morris <james.l.morris@oracle.com>2015-01-15 11:30:54 +1100
commitbb31f607a0900552926ebf9ef3d002d96a43f7cc (patch)
treea6ae975240200606efa47fc0921f2a8f3d27af03 /lib
parenta6391a924cf5a16761ccd6b45094a7d5b9aeebac (diff)
parentb9f918a31d629e99c9ca3d6ac2a2d7a905715c69 (diff)
Merge tag 'keys-next-fixes-20150114' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into next
Diffstat (limited to 'lib')
-rw-r--r--lib/mpi/mpi-cmp.c10
-rw-r--r--lib/mpi/mpi-internal.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/mpi/mpi-cmp.c b/lib/mpi/mpi-cmp.c
index 1871e7b61ca0..d25e9e96c310 100644
--- a/lib/mpi/mpi-cmp.c
+++ b/lib/mpi/mpi-cmp.c
@@ -57,14 +57,12 @@ int mpi_cmp(MPI u, MPI v)
if (usize != vsize && !u->sign && !v->sign)
return usize - vsize;
if (usize != vsize && u->sign && v->sign)
- return vsize + usize;
+ return vsize - usize;
if (!usize)
return 0;
cmp = mpihelp_cmp(u->d, v->d, usize);
- if (!cmp)
- return 0;
- if ((cmp < 0 ? 1 : 0) == (u->sign ? 1 : 0))
- return 1;
- return -1;
+ if (u->sign)
+ return -cmp;
+ return cmp;
}
EXPORT_SYMBOL_GPL(mpi_cmp);
diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h
index 60cf765628e9..c65dd1bff45a 100644
--- a/lib/mpi/mpi-internal.h
+++ b/lib/mpi/mpi-internal.h
@@ -84,7 +84,7 @@ static inline int RESIZE_IF_NEEDED(MPI a, unsigned b)
do { \
mpi_size_t _i; \
for (_i = 0; _i < (n); _i++) \
- (d)[_i] = (d)[_i]; \
+ (d)[_i] = (s)[_i]; \
} while (0)
#define MPN_COPY_DECR(d, s, n) \