diff mbox

[1/4] ext4: remove unsafe and unnecessary memset()

Message ID 1354257706-6582-1-git-send-email-yan@linux.vnet.ibm.com
State Rejected, archived
Headers show

Commit Message

Guo Chao Nov. 30, 2012, 6:41 a.m. UTC
We memset this page before checking whether it's valid. But we need
not memset zeroed page at all.

Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
---
 fs/ext4/super.c |    1 -
 1 file changed, 1 deletion(-)

Comments

Lukas Czerner Nov. 30, 2012, 1:20 p.m. UTC | #1
On Fri, 30 Nov 2012, Guo Chao wrote:

> Date: Fri, 30 Nov 2012 14:41:43 +0800
> From: Guo Chao <yan@linux.vnet.ibm.com>
> To: tytso@mit.edu
> Cc: linux-ext4@vger.kernel.org
> Subject: [PATCH 1/4] ext4: remove unsafe and unnecessary memset()
> 
> We memset this page before checking whether it's valid. But we need
> not memset zeroed page at all.
> 
> Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
> ---
>  fs/ext4/super.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index ad6cd8a..66a4e20 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3206,7 +3206,6 @@ int ext4_calculate_overhead(struct super_block *sb)
>  	ext4_fsblk_t overhead = 0;
>  	char *buf = (char *) get_zeroed_page(GFP_KERNEL);
>  
> -	memset(buf, 0, PAGE_SIZE);
>  	if (!buf)
>  		return -ENOMEM;

Good catch, thanks!

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukas Czerner Nov. 30, 2012, 2:04 p.m. UTC | #2
On Fri, 30 Nov 2012, Lukáš Czerner wrote:

> Date: Fri, 30 Nov 2012 14:20:42 +0100 (CET)
> From: Lukáš Czerner <lczerner@redhat.com>
> To: Guo Chao <yan@linux.vnet.ibm.com>
> Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
> Subject: Re: [PATCH 1/4] ext4: remove unsafe and unnecessary memset()
> 
> On Fri, 30 Nov 2012, Guo Chao wrote:
> 
> > Date: Fri, 30 Nov 2012 14:41:43 +0800
> > From: Guo Chao <yan@linux.vnet.ibm.com>
> > To: tytso@mit.edu
> > Cc: linux-ext4@vger.kernel.org
> > Subject: [PATCH 1/4] ext4: remove unsafe and unnecessary memset()
> > 
> > We memset this page before checking whether it's valid. But we need
> > not memset zeroed page at all.
> > 
> > Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
> > ---
> >  fs/ext4/super.c |    1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > index ad6cd8a..66a4e20 100644
> > --- a/fs/ext4/super.c
> > +++ b/fs/ext4/super.c
> > @@ -3206,7 +3206,6 @@ int ext4_calculate_overhead(struct super_block *sb)
> >  	ext4_fsblk_t overhead = 0;
> >  	char *buf = (char *) get_zeroed_page(GFP_KERNEL);
> >  
> > -	memset(buf, 0, PAGE_SIZE);
> >  	if (!buf)
> >  		return -ENOMEM;
> 
> Good catch, thanks!
> 
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>

It looks like that it has been already fixed with a different patch.

http://www.spinics.net/lists/linux-ext4/msg35310.html

> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Guo Chao Dec. 3, 2012, 2:47 a.m. UTC | #3
On Fri, Nov 30, 2012 at 03:04:59PM +0100, Lukáš Czerner wrote:
> On Fri, 30 Nov 2012, Lukáš Czerner wrote:
> It looks like that it has been already fixed with a different patch.
> 
> http://www.spinics.net/lists/linux-ext4/msg35310.html
>

Hmm ... I did search this function in marc.info. Looks like I should
switch to another database. Thank you for review.

Thanks,
Guo Chao

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ad6cd8a..66a4e20 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3206,7 +3206,6 @@  int ext4_calculate_overhead(struct super_block *sb)
 	ext4_fsblk_t overhead = 0;
 	char *buf = (char *) get_zeroed_page(GFP_KERNEL);
 
-	memset(buf, 0, PAGE_SIZE);
 	if (!buf)
 		return -ENOMEM;