From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: + lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch added to -mm tree Date: Mon, 08 Jun 2020 16:43:35 -0700 Message-ID: <20200608234335.ip8WJ3NXZ%akpm@linux-foundation.org> References: <20200607212615.b050e41fac139a1e16fe00bd@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Return-path: Received: from mail.kernel.org ([198.145.29.99]:49694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387667AbgFHXnh (ORCPT ); Mon, 8 Jun 2020 19:43:37 -0400 In-Reply-To: <20200607212615.b050e41fac139a1e16fe00bd@linux-foundation.org> Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: acme@redhat.com, agordeev@linux.ibm.com, amritha.nambiar@intel.com, andriy.shevchenko@linux.intel.com, chris@chris-wilson.co.uk, keescook@chromium.org, linux@rasmusvillemoes.dk, mm-commits@vger.kernel.org, mszeredi@redhat.com, stable@vger.kernel.org, steffen.klassert@secunet.com, tobin@kernel.org, vineet.gupta1@synopsys.com, will.deacon@arm.com, willemb@google.com, willy@infradead.org, yury.norov@gmail.com The patch titled Subject: lib: fix bitmap_parse() on 64-bit big endian archs has been added to the -mm tree. Its filename is lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Alexander Gordeev Subject: lib: fix bitmap_parse() on 64-bit big endian archs Commit 2d6261583be0 ("lib: rework bitmap_parse()") does not take into account order of halfwords on 64-bit big endian architectures. As result (at least) Receive Packet Steering, IRQ affinity masks and runtime kernel test "test_bitmap" get broken on s390. Link: http://lkml.kernel.org/r/1591634471-17647-1-git-send-email-agordeev@linux.ibm.com Fixes: 2d6261583be0 ("lib: rework bitmap_parse()") Signed-off-by: Alexander Gordeev Cc: Yury Norov Cc: Andy Shevchenko Cc: Amritha Nambiar Cc: Arnaldo Carvalho de Melo Cc: Chris Wilson Cc: Kees Cook Cc: Matthew Wilcox Cc: Miklos Szeredi Cc: Rasmus Villemoes Cc: Steffen Klassert Cc: "Tobin C . Harding" Cc: Vineet Gupta Cc: Will Deacon Cc: Willem de Bruijn Cc: Signed-off-by: Andrew Morton --- lib/bitmap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/lib/bitmap.c~lib-fix-bitmap_parse-on-64-bit-big-endian-archs +++ a/lib/bitmap.c @@ -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; _ Patches currently in -mm which might be from agordeev@linux.ibm.com are lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch