Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Tejun Heo
On Mon, Apr 27, 2015 at 05:39:13PM +0100, Sudeep Holla wrote: > >Yeah, let's get rid of it. > > /me confused, is it fine to push this patch first, and follow up later > after auditing thoroughly to replace with direct scnprintf() I don't really care how it happens as long as the end result is

Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Sudeep Holla
Hi Tejun, On 27/04/15 17:30, Tejun Heo wrote: Hello, Sudeep. On Mon, Apr 27, 2015 at 05:26:16PM +0100, Sudeep Holla wrote: Completely agree and in-fact we did discuss that internally too. But since this function deals only with page size buffers, we thought it's highly unlikely to hit that

Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Tejun Heo
Hello, Sudeep. On Mon, Apr 27, 2015 at 05:26:16PM +0100, Sudeep Holla wrote: > Completely agree and in-fact we did discuss that internally too. > But since this function deals only with page size buffers, we thought > it's highly unlikely to hit that corner case. Ah, yeah, right. It'd probably

Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Sudeep Holla
On 27/04/15 17:14, Tejun Heo wrote: Hello, Sudeep. On Mon, Apr 27, 2015 at 10:46:58AM +0100, Sudeep Holla 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] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Tejun Heo
Hello, Sudeep. On Mon, Apr 27, 2015 at 10:46:58AM +0100, Sudeep Holla wrote: > int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, > int nmaskbits) > { > - ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf - 2; > +

[PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Sudeep Holla
bitmap_print_to_pagebuf uses scnprintf to copy the cpumask/list to page buffer. It handles the newline and trailing null character explicitly. It's unnecessary and also partially duplicated as scnprintf already adds trailing null character. The newline can be passed through format string to

[PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Sudeep Holla
bitmap_print_to_pagebuf uses scnprintf to copy the cpumask/list to page buffer. It handles the newline and trailing null character explicitly. It's unnecessary and also partially duplicated as scnprintf already adds trailing null character. The newline can be passed through format string to

Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Tejun Heo
Hello, Sudeep. On Mon, Apr 27, 2015 at 10:46:58AM +0100, Sudeep Holla wrote: int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, int nmaskbits) { - ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf - 2; + ptrdiff_t

Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Sudeep Holla
Hi Tejun, On 27/04/15 17:30, Tejun Heo wrote: Hello, Sudeep. On Mon, Apr 27, 2015 at 05:26:16PM +0100, Sudeep Holla wrote: Completely agree and in-fact we did discuss that internally too. But since this function deals only with page size buffers, we thought it's highly unlikely to hit that

Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Sudeep Holla
On 27/04/15 17:14, Tejun Heo wrote: Hello, Sudeep. On Mon, Apr 27, 2015 at 10:46:58AM +0100, Sudeep Holla 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] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Tejun Heo
Hello, Sudeep. On Mon, Apr 27, 2015 at 05:26:16PM +0100, Sudeep Holla wrote: Completely agree and in-fact we did discuss that internally too. But since this function deals only with page size buffers, we thought it's highly unlikely to hit that corner case. Ah, yeah, right. It'd probably be

Re: [PATCH] bitmap: remove explicit newline handling using scnprintf format string

2015-04-27 Thread Tejun Heo
On Mon, Apr 27, 2015 at 05:39:13PM +0100, Sudeep Holla wrote: Yeah, let's get rid of it. /me confused, is it fine to push this patch first, and follow up later after auditing thoroughly to replace with direct scnprintf() I don't really care how it happens as long as the end result is the