Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-28 Thread Jean Delvare
On Thu, 28 Sep 2017 10:38:27 +0200, Ingo Molnar wrote: > * Jean Delvare wrote: > > Or... I could append the \n inside the STANDARD_PARAM_DEF macro, so the > > calls are unchanged. Makes my patch smaller, and addresses your concern > > just as well, I suppose. > > Yeah, that would be even better

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-28 Thread Jean Delvare
On Wed, 27 Sep 2017 10:10:31 +0200, Jean Delvare wrote: > Function param_attr_show could overflow the buffer it is operating > on. The buffer size is PAGE_SIZE, and the string returned by > attribute->param->ops->get is generated by scnprintf(buffer, > PAGE_SIZE, ...) so it could be PAGE_SIZE - 1 l

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-28 Thread Ingo Molnar
* Jean Delvare wrote: > > STANDARD_PARAM_DEF(byte,unsigned char, "%hhu\n", > > kstrtou8); > > STANDARD_PARAM_DEF(short, short, "%hi\n", > > kstrtos16); > > STANDARD_PARAM_DEF(ushort, unsigned short, "%hu\n", > > kstrtou16); > > STAN

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-28 Thread Ingo Molnar
* Jean Delvare wrote: > On Thu, 28 Sep 2017 10:02:23 +0200, Jean Delvare wrote: > > On Wed, 27 Sep 2017 15:31:04 +0200, Ingo Molnar wrote: > > > At minimum I'd suggest aligning the definitions vertically, to make sure > > > any missing \n stands out more, visually: > > > > > > STANDARD_PARAM_DE

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-28 Thread Jean Delvare
On Thu, 28 Sep 2017 10:02:23 +0200, Jean Delvare wrote: > On Wed, 27 Sep 2017 15:31:04 +0200, Ingo Molnar wrote: > > At minimum I'd suggest aligning the definitions vertically, to make sure > > any missing \n stands out more, visually: > > > > STANDARD_PARAM_DEF(byte,unsigned char, "%

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-28 Thread Jean Delvare
On Wed, 27 Sep 2017 15:31:04 +0200, Ingo Molnar wrote: > * Jean Delvare wrote: > > > So the \n additions to the STANDARD_PARAM_DEF() lines > > > > > > > +STANDARD_PARAM_DEF(byte, unsigned char, "%hhu\n", kstrtou8); > > > > +STANDARD_PARAM_DEF(short, short, "%hi\n", kstrtos16); > > > > +STANDARD

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-27 Thread Ingo Molnar
* Jean Delvare wrote: > > > -STANDARD_PARAM_DEF(byte, unsigned char, "%hhu", kstrtou8); > > > -STANDARD_PARAM_DEF(short, short, "%hi", kstrtos16); > > > -STANDARD_PARAM_DEF(ushort, unsigned short, "%hu", kstrtou16); > > > -STANDARD_PARAM_DEF(int, int, "%i", kstrtoint); > > > -STANDARD_PARAM_DEF(

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-27 Thread Jean Delvare
Hi Ingo, On mer., 2017-09-27 at 10:26 +0200, Ingo Molnar wrote: > * Jean Delvare wrote: > > > Function param_attr_show could overflow the buffer it is operating > > on. The buffer size is PAGE_SIZE, and the string returned by > > attribute->param->ops->get is generated by scnprintf(buffer, > > P

Re: [PATCH] params: Fix an overflow in param_attr_show

2017-09-27 Thread Ingo Molnar
* Jean Delvare wrote: > Function param_attr_show could overflow the buffer it is operating > on. The buffer size is PAGE_SIZE, and the string returned by > attribute->param->ops->get is generated by scnprintf(buffer, > PAGE_SIZE, ...) so it could be PAGE_SIZE - 1 long, with the > terminating '\0

[PATCH] params: Fix an overflow in param_attr_show

2017-09-27 Thread Jean Delvare
Function param_attr_show could overflow the buffer it is operating on. The buffer size is PAGE_SIZE, and the string returned by attribute->param->ops->get is generated by scnprintf(buffer, PAGE_SIZE, ...) so it could be PAGE_SIZE - 1 long, with the terminating '\0' at the very end of the buffer. Ca