* [PATCH v2 1/2] lib/test_bitmap: Correct test data offsets for 32-bit
@ 2020-01-09 10:36 Andy Shevchenko
2020-01-09 10:36 ` [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-01-09 10:36 UTC (permalink / raw)
To: Rasmus Villemoes, Yury Norov, linux-kernel, Andrew Morton, Guenter Roeck
Cc: Andy Shevchenko
On 32-bit platform the size of long is only 32 bits which makes wrong offset
in the array of 64 bit size.
Calculate offset based on BITS_PER_LONG.
Fixes: 30544ed5de43 ("lib/bitmap: introduce bitmap_replace() helper")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: rename step -> nlongs to avoid confusion with a macro (Yury)
lib/test_bitmap.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 5cb35a734462..707b0389db35 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -275,22 +275,23 @@ static void __init test_copy(void)
static void __init test_replace(void)
{
unsigned int nbits = 64;
+ unsigned int nlongs = DIV_ROUND_UP(nbits, BITS_PER_LONG);
DECLARE_BITMAP(bmap, 1024);
bitmap_zero(bmap, 1024);
- bitmap_replace(bmap, &exp2[0], &exp2[1], exp2_to_exp3_mask, nbits);
+ bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits);
expect_eq_bitmap(bmap, exp3_0_1, nbits);
bitmap_zero(bmap, 1024);
- bitmap_replace(bmap, &exp2[1], &exp2[0], exp2_to_exp3_mask, nbits);
+ bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits);
expect_eq_bitmap(bmap, exp3_1_0, nbits);
bitmap_fill(bmap, 1024);
- bitmap_replace(bmap, &exp2[0], &exp2[1], exp2_to_exp3_mask, nbits);
+ bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits);
expect_eq_bitmap(bmap, exp3_0_1, nbits);
bitmap_fill(bmap, 1024);
- bitmap_replace(bmap, &exp2[1], &exp2[0], exp2_to_exp3_mask, nbits);
+ bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits);
expect_eq_bitmap(bmap, exp3_1_0, nbits);
}
--
2.24.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer
2020-01-09 10:36 [PATCH v2 1/2] lib/test_bitmap: Correct test data offsets for 32-bit Andy Shevchenko
@ 2020-01-09 10:36 ` Andy Shevchenko
2020-01-09 20:08 ` Andrew Morton
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-01-09 10:36 UTC (permalink / raw)
To: Rasmus Villemoes, Yury Norov, linux-kernel, Andrew Morton, Guenter Roeck
Cc: Andy Shevchenko
Force address space to avoid the following warning:
lib/test_bitmap.c:461:53: warning: incorrect type in argument 1 (different address spaces)
lib/test_bitmap.c:461:53: expected char const [noderef] <asn:1> *ubuf
lib/test_bitmap.c:461:53: got char const *in
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
lib/test_bitmap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 707b0389db35..61ed71c1daba 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -458,7 +458,8 @@ static void __init __test_bitmap_parse(int is_user)
set_fs(KERNEL_DS);
time = ktime_get();
- err = bitmap_parse_user(test.in, len, bmap, test.nbits);
+ err = bitmap_parse_user((__force const char __user *)test.in, len,
+ bmap, test.nbits);
time = ktime_get() - time;
set_fs(orig_fs);
} else {
--
2.24.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer
2020-01-09 10:36 ` [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer Andy Shevchenko
@ 2020-01-09 20:08 ` Andrew Morton
2020-01-09 21:04 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2020-01-09 20:08 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Rasmus Villemoes, Yury Norov, linux-kernel, Guenter Roeck
On Thu, 9 Jan 2020 12:36:01 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Force address space to avoid the following warning:
>
> lib/test_bitmap.c:461:53: warning: incorrect type in argument 1 (different address spaces)
> lib/test_bitmap.c:461:53: expected char const [noderef] <asn:1> *ubuf
> lib/test_bitmap.c:461:53: got char const *in
We did this in
commit 17b6753ff08bc47f50da09f5185849172c598315
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Wed Dec 4 16:53:06 2019 -0800
Commit: Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Wed Dec 4 19:44:14 2019 -0800
lib/test_bitmap: force argument of bitmap_parselist_user() to proper address space
> --- a/lib/test_bitmap.c
> +++ b/lib/test_bitmap.c
> @@ -458,7 +458,8 @@ static void __init __test_bitmap_parse(int is_user)
>
> set_fs(KERNEL_DS);
> time = ktime_get();
> - err = bitmap_parse_user(test.in, len, bmap, test.nbits);
> + err = bitmap_parse_user((__force const char __user *)test.in, len,
> + bmap, test.nbits);
> time = ktime_get() - time;
> set_fs(orig_fs);
> } else {
Except your tree has `test' where mainline has `ptest'. I'm not sure
what has happened here?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer
2020-01-09 20:08 ` Andrew Morton
@ 2020-01-09 21:04 ` Andy Shevchenko
2020-01-09 21:52 ` Andrew Morton
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-01-09 21:04 UTC (permalink / raw)
To: Andrew Morton
Cc: Andy Shevchenko, Rasmus Villemoes, Yury Norov,
Linux Kernel Mailing List, Guenter Roeck
On Thu, Jan 9, 2020 at 10:53 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Thu, 9 Jan 2020 12:36:01 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > Force address space to avoid the following warning:
> >
> > lib/test_bitmap.c:461:53: warning: incorrect type in argument 1 (different address spaces)
> > lib/test_bitmap.c:461:53: expected char const [noderef] <asn:1> *ubuf
> > lib/test_bitmap.c:461:53: got char const *in
>
> We did this in
>
> commit 17b6753ff08bc47f50da09f5185849172c598315
> Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> AuthorDate: Wed Dec 4 16:53:06 2019 -0800
> Commit: Linus Torvalds <torvalds@linux-foundation.org>
> CommitDate: Wed Dec 4 19:44:14 2019 -0800
>
> lib/test_bitmap: force argument of bitmap_parselist_user() to proper address space
This is for "parseLIST", while new patch for "parse".
>
> > --- a/lib/test_bitmap.c
> > +++ b/lib/test_bitmap.c
> > @@ -458,7 +458,8 @@ static void __init __test_bitmap_parse(int is_user)
> >
> > set_fs(KERNEL_DS);
> > time = ktime_get();
> > - err = bitmap_parse_user(test.in, len, bmap, test.nbits);
> > + err = bitmap_parse_user((__force const char __user *)test.in, len,
> > + bmap, test.nbits);
> > time = ktime_get() - time;
> > set_fs(orig_fs);
> > } else {
>
> Except your tree has `test' where mainline has `ptest'. I'm not sure
> what has happened here?
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer
2020-01-09 21:04 ` Andy Shevchenko
@ 2020-01-09 21:52 ` Andrew Morton
2020-01-09 23:00 ` Guenter Roeck
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2020-01-09 21:52 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Andy Shevchenko, Rasmus Villemoes, Yury Norov,
Linux Kernel Mailing List, Guenter Roeck
On Thu, 9 Jan 2020 23:04:59 +0200 Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Thu, Jan 9, 2020 at 10:53 PM Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Thu, 9 Jan 2020 12:36:01 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Force address space to avoid the following warning:
> > >
> > > lib/test_bitmap.c:461:53: warning: incorrect type in argument 1 (different address spaces)
> > > lib/test_bitmap.c:461:53: expected char const [noderef] <asn:1> *ubuf
> > > lib/test_bitmap.c:461:53: got char const *in
> >
> > We did this in
> >
> > commit 17b6753ff08bc47f50da09f5185849172c598315
> > Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > AuthorDate: Wed Dec 4 16:53:06 2019 -0800
> > Commit: Linus Torvalds <torvalds@linux-foundation.org>
> > CommitDate: Wed Dec 4 19:44:14 2019 -0800
> >
> > lib/test_bitmap: force argument of bitmap_parselist_user() to proper address space
>
> This is for "parseLIST", while new patch for "parse".
Oh. This is a fix against the mm patch
lib-add-test-for-bitmap_parse.patch. Please tell us such things!
But [patch 1/2] is applicable to current mainline, yes?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer
2020-01-09 21:52 ` Andrew Morton
@ 2020-01-09 23:00 ` Guenter Roeck
0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2020-01-09 23:00 UTC (permalink / raw)
To: Andrew Morton
Cc: Andy Shevchenko, Andy Shevchenko, Rasmus Villemoes, Yury Norov,
Linux Kernel Mailing List
On Thu, Jan 09, 2020 at 01:52:53PM -0800, Andrew Morton wrote:
> On Thu, 9 Jan 2020 23:04:59 +0200 Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>
> > On Thu, Jan 9, 2020 at 10:53 PM Andrew Morton <akpm@linux-foundation.org> wrote:
> > >
> > > On Thu, 9 Jan 2020 12:36:01 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > > Force address space to avoid the following warning:
> > > >
> > > > lib/test_bitmap.c:461:53: warning: incorrect type in argument 1 (different address spaces)
> > > > lib/test_bitmap.c:461:53: expected char const [noderef] <asn:1> *ubuf
> > > > lib/test_bitmap.c:461:53: got char const *in
> > >
> > > We did this in
> > >
> > > commit 17b6753ff08bc47f50da09f5185849172c598315
> > > Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > AuthorDate: Wed Dec 4 16:53:06 2019 -0800
> > > Commit: Linus Torvalds <torvalds@linux-foundation.org>
> > > CommitDate: Wed Dec 4 19:44:14 2019 -0800
> > >
> > > lib/test_bitmap: force argument of bitmap_parselist_user() to proper address space
> >
> > This is for "parseLIST", while new patch for "parse".
>
> Oh. This is a fix against the mm patch
> lib-add-test-for-bitmap_parse.patch. Please tell us such things!
>
> But [patch 1/2] is applicable to current mainline, yes?
>
Yes
Guenter
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-01-09 23:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 10:36 [PATCH v2 1/2] lib/test_bitmap: Correct test data offsets for 32-bit Andy Shevchenko
2020-01-09 10:36 ` [PATCH v2 2/2] lib/test_bitmap: Fix address space when test user buffer Andy Shevchenko
2020-01-09 20:08 ` Andrew Morton
2020-01-09 21:04 ` Andy Shevchenko
2020-01-09 21:52 ` Andrew Morton
2020-01-09 23:00 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.