VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Stefano Brivio <sbrivio@redhat.com> 2020-08-11 18:34:29 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2020-08-12 10:57:59 -0700 commit: 5959f829a93c18ccf15715768317b58f5d9bf2d4 parent: 25fd529c34d063d1bef23742f2e8f8341c639dc3
Commit Summary:
lib/bitmap.c: fix bitmap_cut() for partial overlapping case
Diffstat:
1 file changed, 2 insertions, 2 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 0364452b1617..c13d859bc7ab 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -212,13 +212,13 @@ void bitmap_cut(unsigned long *dst, const unsigned long *src,
 	unsigned long keep = 0, carry;
 	int i;
 
-	memmove(dst, src, len * sizeof(*dst));
-
 	if (first % BITS_PER_LONG) {
 		keep = src[first / BITS_PER_LONG] &
 		       (~0UL >> (BITS_PER_LONG - first % BITS_PER_LONG));
 	}
 
+	memmove(dst, src, len * sizeof(*dst));
+
 	while (cut--) {
 		for (i = first / BITS_PER_LONG; i < len; i++) {
 			if (i < len - 1)