Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Michal Nazarewicz
On Sat, May 28 2016, Dan Carpenter wrote: > Try compiling the code you suggested. I find this amusing to be perfectly honest. Kernel uses designated initialisers, flexible array members, stdint.h, compound literals and variadic macros, yet still for some reason sticks to -std=gnu89. No matter, t

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Dan Carpenter
On Sat, May 28, 2016 at 12:15:24PM +0200, Michal Nazarewicz wrote: > On Sat, May 28 2016, Dan Carpenter wrote: > > Also in the kernel we have to declare variables at the start of the > > block. > > /me shrugs > > I looked at this out of curiosity and there are precedents: > > $ git grep 'for

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Dan Carpenter
On Sat, May 28, 2016 at 12:15:24PM +0200, Michal Nazarewicz wrote: > On Sat, May 28 2016, Dan Carpenter wrote: > > Also in the kernel we have to declare variables at the start of the > > block. > > /me shrugs > > I looked at this out of curiosity and there are precedents: > > $ git grep 'for

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Michal Nazarewicz
On Sat, May 28 2016, Dan Carpenter wrote: > Also in the kernel we have to declare variables at the start of the > block. /me shrugs I looked at this out of curiosity and there are precedents: $ git grep 'for (\(int\|unsigned\|signed\|long\|char\)[[:space:]]' |wc -l 19 (albeit mostly in

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread Dan Carpenter
On Fri, May 27, 2016 at 07:25:30PM +0200, walter harms wrote: > > > Am 27.05.2016 14:23, schrieb Michal Nazarewicz: > > On Fri, May 27 2016, Dan Carpenter wrote: > >> diff --git a/drivers/usb/gadget/function/f_fs.c > >> b/drivers/usb/gadget/function/f_fs.c > >> index 73515d5..7fff81a 100644 > >>

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread walter harms
Am 27.05.2016 14:23, schrieb Michal Nazarewicz: > On Fri, May 27 2016, Dan Carpenter wrote: >> This loop is supposed to set all the .num values to -1 but it's doesn't >> set the first element and it sets one element beyond the end of the >> array. Really there is no reason for it to be done back

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread Michal Nazarewicz
On Fri, May 27 2016, Dan Carpenter wrote: > This loop is supposed to set all the .num values to -1 but it's doesn't > set the first element and it sets one element beyond the end of the > array. Really there is no reason for it to be done backwards. And > "ret" is the wrong variable to use for an

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread walter harms
Am 27.05.2016 13:23, schrieb Dan Carpenter: > This loop is supposed to set all the .num values to -1 but it's doesn't > set the first element and it sets one element beyond the end of the > array. Really there is no reason for it to be done backwards. And > "ret" is the wrong variable to use fo

[patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread Dan Carpenter
This loop is supposed to set all the .num values to -1 but it's doesn't set the first element and it sets one element beyond the end of the array. Really there is no reason for it to be done backwards. And "ret" is the wrong variable to use for an iterator. Fixes: ddf8abd25994 ('USB: f_fs: the F