From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx146.postini.com [74.125.245.146]) by kanga.kvack.org (Postfix) with SMTP id 63AC36B006C for ; Wed, 13 Jun 2012 21:35:36 -0400 (EDT) Message-ID: <4FD93FE8.1030102@kernel.org> Date: Thu, 14 Jun 2012 10:35:36 +0900 From: Minchan Kim MIME-Version: 1.0 Subject: Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning References: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> In-Reply-To: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Seth Jennings Cc: Greg Kroah-Hartman , Nitin Gupta , Konrad Rzeszutek Wilk , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, 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 Nice catch! Acked-by: Minchan Kim 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx164.postini.com [74.125.245.164]) by kanga.kvack.org (Postfix) with SMTP id 96E456B005C for ; Thu, 14 Jun 2012 10:17:17 -0400 (EDT) Received: from /spool/local by e5.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Jun 2012 10:17:16 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 8721D6E806F for ; Thu, 14 Jun 2012 10:14:24 -0400 (EDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5EEENIJ200954 for ; Thu, 14 Jun 2012 10:14:23 -0400 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5EEDtu3008115 for ; Thu, 14 Jun 2012 08:13:56 -0600 Message-ID: <4FD9F19E.4000209@linux.vnet.ibm.com> Date: Thu, 14 Jun 2012 09:13:50 -0500 From: Seth Jennings MIME-Version: 1.0 Subject: Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning References: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> <4FD93FE8.1030102@kernel.org> In-Reply-To: <4FD93FE8.1030102@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Minchan Kim Cc: Greg Kroah-Hartman , Nitin Gupta , Konrad Rzeszutek Wilk , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, 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. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752230Ab2FMVEp (ORCPT ); Wed, 13 Jun 2012 17:04:45 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:55149 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732Ab2FMVEo (ORCPT ); Wed, 13 Jun 2012 17:04:44 -0400 From: Seth Jennings To: Greg Kroah-Hartman Cc: Seth Jennings , Nitin Gupta , Minchan Kim , Konrad Rzeszutek Wilk , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Andrew Morton Subject: [PATCH] staging: zsmalloc: fix uninit'ed variable warning Date: Wed, 13 Jun 2012 16:03:42 -0500 Message-Id: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12061321-4242-0000-0000-000001F59E3C Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755032Ab2FNBfh (ORCPT ); Wed, 13 Jun 2012 21:35:37 -0400 Received: from LGEMRELSE1Q.lge.com ([156.147.1.111]:42214 "EHLO LGEMRELSE1Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752963Ab2FNBfg (ORCPT ); Wed, 13 Jun 2012 21:35:36 -0400 X-AuditID: 9c93016f-b7c3cae000001954-02-4fd93fe679b8 Message-ID: <4FD93FE8.1030102@kernel.org> Date: Thu, 14 Jun 2012 10:35:36 +0900 From: Minchan Kim User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 Newsgroups: gmane.linux.kernel To: Seth Jennings CC: Greg Kroah-Hartman , Nitin Gupta , Konrad Rzeszutek Wilk , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Andrew Morton , "linux-mm@kvack.org" Subject: Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning References: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> In-Reply-To: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 Nice catch! Acked-by: Minchan Kim 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756182Ab2FNOOU (ORCPT ); Thu, 14 Jun 2012 10:14:20 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:39000 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756038Ab2FNOOS (ORCPT ); Thu, 14 Jun 2012 10:14:18 -0400 Message-ID: <4FD9F19E.4000209@linux.vnet.ibm.com> Date: Thu, 14 Jun 2012 09:13:50 -0500 From: Seth Jennings User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Minchan Kim CC: Greg Kroah-Hartman , Nitin Gupta , Konrad Rzeszutek Wilk , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Andrew Morton , "linux-mm@kvack.org" Subject: Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning References: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> <4FD93FE8.1030102@kernel.org> In-Reply-To: <4FD93FE8.1030102@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12061414-1780-0000-0000-0000067045D9 X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000281; HX=3.00000190; KW=3.00000007; PH=3.00000001; SC=3.00000002; SDB=6.00147990; UDB=6.00033754; UTC=2012-06-14 14:14:16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932318Ab2FNQzG (ORCPT ); Thu, 14 Jun 2012 12:55:06 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:35969 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756437Ab2FNQvr (ORCPT ); Thu, 14 Jun 2012 12:51:47 -0400 Date: Thu, 14 Jun 2012 12:44:09 -0400 From: Konrad Rzeszutek Wilk To: Seth Jennings Cc: Greg Kroah-Hartman , Nitin Gupta , Minchan Kim , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH] staging: zsmalloc: fix uninit'ed variable warning Message-ID: <20120614164409.GB333@phenom.dumpdata.com> References: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1339621422-8449-1-git-send-email-sjenning@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Konrad Rzeszutek Wilk > --- > 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