Merge tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / lib / mpi / mpicoder.c
index c20ef27ad87675a15ee8ca25e9d2d19798268e7b..3db76b8c11158f5ce2b3884898e3d2abfbd6d91a 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #include <linux/bitops.h>
-#include <asm-generic/bitops/count_zeros.h>
+#include <linux/count_zeros.h>
 #include "mpi-internal.h"
 
 #define MAX_EXTERN_MPI_BITS 16384
@@ -446,8 +446,11 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int len)
                const u8 *buff = sg_virt(sg);
                int len = sg->length;
 
-               while (len-- && !*buff++)
+               while (len && !*buff) {
                        lzeros++;
+                       len--;
+                       buff++;
+               }
 
                if (len && *buff)
                        break;