* [PATCH] staging: zsmalloc: fix uninit'ed variable warning
@ 2012-06-13 21:03 Seth Jennings
2012-06-14 1:35 ` Minchan Kim
2012-06-14 16:44 ` Konrad Rzeszutek Wilk
0 siblings, 2 replies; 4+ messages in thread
From: Seth Jennings @ 2012-06-13 21:03 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Seth Jennings, Nitin Gupta, Minchan Kim, Konrad Rzeszutek Wilk,
devel, linux-kernel, Andrew Morton
This patch fixes an uninitialized variable warning in
alloc_zspage(). It also fixes the secondary issue of
prev_page leaving scope on each loop iteration. The only
reason this ever worked was because prev_page was occupying
the same space on the stack on each iteration.
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
---
drivers/staging/zsmalloc/zsmalloc-main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index fb54a9b..4af3dd6 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -400,7 +400,7 @@ static void init_zspage(struct page *first_page, struct size_class *class)
static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
{
int i, error;
- struct page *first_page = NULL;
+ struct page *first_page = NULL, *uninitialized_var(prev_page);
/*
* Allocate individual pages and link them together as:
@@ -415,7 +415,7 @@ static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
*/
error = -ENOMEM;
for (i = 0; i < class->pages_per_zspage; i++) {
- struct page *page, *prev_page;
+ struct page *page;
page = alloc_page(flags);
if (!page)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning
2012-06-13 21:03 [PATCH] staging: zsmalloc: fix uninit'ed variable warning Seth Jennings
@ 2012-06-14 1:35 ` Minchan Kim
2012-06-14 14:13 ` Seth Jennings
2012-06-14 16:44 ` Konrad Rzeszutek Wilk
1 sibling, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2012-06-14 1:35 UTC (permalink / raw)
To: Seth Jennings
Cc: Greg Kroah-Hartman, Nitin Gupta, Konrad Rzeszutek Wilk, devel,
linux-kernel, Andrew Morton, linux-mm@kvack.org
Hi Seth,
On 06/14/2012 06:03 AM, Seth Jennings wrote:
> This patch fixes an uninitialized variable warning in
> alloc_zspage(). It also fixes the secondary issue of
> prev_page leaving scope on each loop iteration. The only
> reason this ever worked was because prev_page was occupying
> the same space on the stack on each iteration.
>
> Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Nice catch!
Acked-by: Minchan Kim <minchan@kernel.org>
Nitpick:
I can't see the warning.
My gcc version is gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3.
Please, Cced linux-mm, too.
Some guys in mm might have a interest in zsmalloc. :)
--
Kind regards,
Minchan Kim
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning
2012-06-14 1:35 ` Minchan Kim
@ 2012-06-14 14:13 ` Seth Jennings
0 siblings, 0 replies; 4+ messages in thread
From: Seth Jennings @ 2012-06-14 14:13 UTC (permalink / raw)
To: Minchan Kim
Cc: Greg Kroah-Hartman, Nitin Gupta, Konrad Rzeszutek Wilk, devel,
linux-kernel, Andrew Morton, linux-mm@kvack.org
On 06/13/2012 08:35 PM, Minchan Kim wrote:
> Nice catch!
by Andrew!
> Nitpick:
> I can't see the warning.
> My gcc version is gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3.
I couldn't either but Andrew could and he verified the fix.
Not sure what gcc version he is running.
> Please, Cced linux-mm, too.
> Some guys in mm might have a interest in zsmalloc. :)
Meant to include linux-mm :-/ I'll be sure to include
them in future zsmalloc patches.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning
2012-06-13 21:03 [PATCH] staging: zsmalloc: fix uninit'ed variable warning Seth Jennings
2012-06-14 1:35 ` Minchan Kim
@ 2012-06-14 16:44 ` Konrad Rzeszutek Wilk
1 sibling, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-06-14 16:44 UTC (permalink / raw)
To: Seth Jennings
Cc: Greg Kroah-Hartman, Nitin Gupta, Minchan Kim, devel, linux-kernel,
Andrew Morton
On Wed, Jun 13, 2012 at 04:03:42PM -0500, Seth Jennings wrote:
> This patch fixes an uninitialized variable warning in
> alloc_zspage(). It also fixes the secondary issue of
> prev_page leaving scope on each loop iteration. The only
> reason this ever worked was because prev_page was occupying
> the same space on the stack on each iteration.
>
> Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> drivers/staging/zsmalloc/zsmalloc-main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
> index fb54a9b..4af3dd6 100644
> --- a/drivers/staging/zsmalloc/zsmalloc-main.c
> +++ b/drivers/staging/zsmalloc/zsmalloc-main.c
> @@ -400,7 +400,7 @@ static void init_zspage(struct page *first_page, struct size_class *class)
> static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
> {
> int i, error;
> - struct page *first_page = NULL;
> + struct page *first_page = NULL, *uninitialized_var(prev_page);
>
> /*
> * Allocate individual pages and link them together as:
> @@ -415,7 +415,7 @@ static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
> */
> error = -ENOMEM;
> for (i = 0; i < class->pages_per_zspage; i++) {
> - struct page *page, *prev_page;
> + struct page *page;
>
> page = alloc_page(flags);
> if (!page)
> --
> 1.7.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-14 16:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-13 21:03 [PATCH] staging: zsmalloc: fix uninit'ed variable warning Seth Jennings
2012-06-14 1:35 ` Minchan Kim
2012-06-14 14:13 ` Seth Jennings
2012-06-14 16:44 ` Konrad Rzeszutek Wilk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox