Re: [PATCH 6/7] lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf

2018-08-20 Thread Rasmus Villemoes
On 2018-08-19 14:37, Andy Shevchenko wrote: > On Sat, Aug 18, 2018 at 4:17 PM Rasmus Villemoes > wrote: >> >> int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long >> *maskp, >> int nmaskbits) >> { >> - ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE

Re: [PATCH 6/7] lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf

2018-08-19 Thread Andy Shevchenko
On Sat, Aug 18, 2018 at 4:17 PM Rasmus Villemoes wrote: > > For various alignments of buf, the current expression computes > > 4096 ok > 4095 ok > 8190 > 8189 > ... > 4097 > > i.e., if the caller has already written two bytes into the page buffer, > len is 8190 rather than 4094, because PTR_ALIGN

[PATCH 6/7] lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf

2018-08-18 Thread Rasmus Villemoes
For various alignments of buf, the current expression computes 4096 ok 4095 ok 8190 8189 ... 4097 i.e., if the caller has already written two bytes into the page buffer, len is 8190 rather than 4094, because PTR_ALIGN aligns up to the next boundary. So if the printed version of the bitmap is huge