@@ -740,6 +740,7 @@ int bitmap_parse(const char *start, unsi
const char *end = strnchrnul(start, buflen, '\n') - 1;
int chunks = BITS_TO_U32(nmaskbits);
u32 *bitmap = (u32 *)maskp;
+ int chunk = 0;
int unset_bit;
while (1) {
@@ -750,9 +751,14 @@ int bitmap_parse(const char *start, unsi
if (!chunks--)
return -EOVERFLOW;
- end = bitmap_get_x32_reverse(start, end, bitmap++);
+#if defined(CONFIG_64BIT) && defined(__BIG_ENDIAN)
+ end = bitmap_get_x32_reverse(start, end, &bitmap[chunk ^ 1]);
+#else
+ end = bitmap_get_x32_reverse(start, end, &bitmap[chunk]);
+#endif
if (IS_ERR(end))
return PTR_ERR(end);
+ chunk++;
}
unset_bit = (BITS_TO_U32(nmaskbits) - chunks) * 32;