Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-11 Thread Doug Ledford
On 02/09/2016 03:11 PM, Rasmus Villemoes wrote: > The while loop after err_slaves should use post-decrement; otherwise > we'll fail to do the kfrees for i==0, and will run into out-of-bounds > accesses if the setup above failed already at i==0. > > The predecrement in the --port is ok, since

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-11 Thread Jack Morgenstein
Ouch! Egg on my face! Sorry about that. You are correct! while (--i >= 0) IS exactly equivalent to while (i--). (the while condition is fully evaluated before the loop is entered; pre or post increment only influences which value is tested for true in the while condition -- the pre-value (with

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-11 Thread Jack Morgenstein
On Wed, 10 Feb 2016 19:15:20 +0100 Rasmus Villemoes wrote: > On Wed, Feb 10 2016, Yishai Hadas wrote: > > >> @@ -2429,7 +2429,7 @@ err_thread: > >>flush_workqueue(priv->mfunc.master.comm_wq); > >>destroy_workqueue(priv->mfunc.master.comm_wq); > >> err_slaves: > >> - while (--i) { >

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-11 Thread Jack Morgenstein
On Wed, 10 Feb 2016 19:15:20 +0100 Rasmus Villemoes wrote: > On Wed, Feb 10 2016, Yishai Hadas wrote: > > >> @@ -2429,7 +2429,7 @@ err_thread: > >>flush_workqueue(priv->mfunc.master.comm_wq); > >>

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-11 Thread Jack Morgenstein
Ouch! Egg on my face! Sorry about that. You are correct! while (--i >= 0) IS exactly equivalent to while (i--). (the while condition is fully evaluated before the loop is entered; pre or post increment only influences which value is tested for true in the while condition -- the pre-value (with

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-11 Thread Doug Ledford
On 02/09/2016 03:11 PM, Rasmus Villemoes wrote: > The while loop after err_slaves should use post-decrement; otherwise > we'll fail to do the kfrees for i==0, and will run into out-of-bounds > accesses if the setup above failed already at i==0. > > The predecrement in the --port is ok, since

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-10 Thread Rasmus Villemoes
On Wed, Feb 10 2016, Yishai Hadas wrote: >> @@ -2429,7 +2429,7 @@ err_thread: >> flush_workqueue(priv->mfunc.master.comm_wq); >> destroy_workqueue(priv->mfunc.master.comm_wq); >> err_slaves: >> -while (--i) { >> +while (i--) { > > This fix is wrong as it hits the case that i

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-10 Thread Yishai Hadas
On 2/9/2016 10:11 PM, Rasmus Villemoes wrote: The while loop after err_slaves should use post-decrement; otherwise we'll fail to do the kfrees for i==0, and will run into out-of-bounds accesses if the setup above failed already at i==0. The predecrement in the --port is ok, since ->vlan_filter

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-10 Thread Rasmus Villemoes
On Wed, Feb 10 2016, Yishai Hadas wrote: >> @@ -2429,7 +2429,7 @@ err_thread: >> flush_workqueue(priv->mfunc.master.comm_wq); >> destroy_workqueue(priv->mfunc.master.comm_wq); >> err_slaves: >> -while (--i) { >> +while (i--) { > > This fix is wrong

Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-10 Thread Yishai Hadas
On 2/9/2016 10:11 PM, Rasmus Villemoes wrote: The while loop after err_slaves should use post-decrement; otherwise we'll fail to do the kfrees for i==0, and will run into out-of-bounds accesses if the setup above failed already at i==0. The predecrement in the --port is ok, since ->vlan_filter

[PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-09 Thread Rasmus Villemoes
The while loop after err_slaves should use post-decrement; otherwise we'll fail to do the kfrees for i==0, and will run into out-of-bounds accesses if the setup above failed already at i==0. The predecrement in the --port is ok, since ->vlan_filter is (bizarrely) 1-indexed. But I'm changing 'if'

[PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()

2016-02-09 Thread Rasmus Villemoes
The while loop after err_slaves should use post-decrement; otherwise we'll fail to do the kfrees for i==0, and will run into out-of-bounds accesses if the setup above failed already at i==0. The predecrement in the --port is ok, since ->vlan_filter is (bizarrely) 1-indexed. But I'm changing 'if'