* [PATCH v2] Staging: lustre: Convert array index from the loop bound to the loop index.
@ 2016-09-16 21:31 Sandhya Bankar
2016-09-17 8:47 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Sandhya Bankar @ 2016-09-16 21:31 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh, oleg.drokin, andreas.dilger, jsimmons
Convert array index from the loop bound to the loop index.
The structure cl_env_percpu[NR_CPUS] has been initializing for each
possible cpu (i.e 0 to i) but during initialization if any error will
occurred this come to the error handling code which should uninitialize
the cl_env_percpu upto i but currently cleanup is happening repeatedly for
the same cl_env_percpu[i] element which does not seems to be correct.
Used below semantic patch to identify this issue:
@@
expression e1,e2,ar;
@@
for(e1 = 0; e1 < e2; e1++) { <...
ar[
- e2
+ e1
]
...> }
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
Changes in v2:
*Correcting the commit message.
drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c
index 91a5806..eeccd30 100755
--- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
@@ -1000,7 +1000,7 @@ static int cl_env_percpu_init(void)
* thus we must uninitialize up to i, the rest are undefined.
*/
for (j = 0; j < i; j++) {
- cle = &cl_env_percpu[i];
+ cle = &cl_env_percpu[j];
lu_context_exit(&cle->ce_ses);
lu_context_fini(&cle->ce_ses);
lu_env_fini(&cle->ce_lu);
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH v2] Staging: lustre: Convert array index from the loop bound to the loop index.
2016-09-16 21:31 [PATCH v2] Staging: lustre: Convert array index from the loop bound to the loop index Sandhya Bankar
@ 2016-09-17 8:47 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2016-09-17 8:47 UTC (permalink / raw)
To: Sandhya Bankar
Cc: outreachy-kernel, gregkh, oleg.drokin, andreas.dilger, jsimmons
On Sat, 17 Sep 2016, Sandhya Bankar wrote:
> Convert array index from the loop bound to the loop index.
>
> The structure cl_env_percpu[NR_CPUS] has been initializing for each
> possible cpu (i.e 0 to i) but during initialization if any error will
> occurred this come to the error handling code which should uninitialize
> the cl_env_percpu upto i but currently cleanup is happening repeatedly for
> the same cl_env_percpu[i] element which does not seems to be correct.
This is one very long sentence. It would be more understandable with
several shorter sentences.
julia
>
> Used below semantic patch to identify this issue:
>
> @@
> expression e1,e2,ar;
> @@
>
> for(e1 = 0; e1 < e2; e1++) { <...
> ar[
> - e2
> + e1
> ]
> ...> }
>
> Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
> ---
> Changes in v2:
> *Correcting the commit message.
> drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c
> index 91a5806..eeccd30 100755
> --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
> +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
> @@ -1000,7 +1000,7 @@ static int cl_env_percpu_init(void)
> * thus we must uninitialize up to i, the rest are undefined.
> */
> for (j = 0; j < i; j++) {
> - cle = &cl_env_percpu[i];
> + cle = &cl_env_percpu[j];
> lu_context_exit(&cle->ce_ses);
> lu_context_fini(&cle->ce_ses);
> lu_env_fini(&cle->ce_lu);
> --
> 1.7.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160916213106.GA4147%40sandhya.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-17 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 21:31 [PATCH v2] Staging: lustre: Convert array index from the loop bound to the loop index Sandhya Bankar
2016-09-17 8:47 ` [Outreachy kernel] " Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.