public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] : make sure the buffer head members are zeroed out before using them.
@ 2009-01-20 17:06 Manish Katiyar
  2009-01-25 15:53 ` Manish Katiyar
  0 siblings, 1 reply; 10+ messages in thread
From: Manish Katiyar @ 2009-01-20 17:06 UTC (permalink / raw)
  To: ext4, Theodore Ts'o, cmm; +Cc: mkatiyar

ext2_quota_read doesn't bzeroes tmp_bh before calling ext2_get_block()
where we access the b_size of it. Since it is a local variable it
might contain some garbage. Make sure it is filled with zero before
passing.

Signed-off-by : Manish Katiyar <mkatiyar@gmail.com>
---
 fs/ext2/super.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index da8bdea..d10aa44 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1327,7 +1327,7 @@ static ssize_t ext2_quota_read(struct
super_block *sb, int type, char *data,
 		tocopy = sb->s_blocksize - offset < toread ?
 				sb->s_blocksize - offset : toread;

-		tmp_bh.b_state = 0;
+		memset(&tmp_bh, 0, sizeof(struct buffer_head));
 		err = ext2_get_block(inode, blk, &tmp_bh, 0);
 		if (err < 0)
 			return err;
@@ -1366,7 +1366,7 @@ static ssize_t ext2_quota_write(struct
super_block *sb, int type,
 		tocopy = sb->s_blocksize - offset < towrite ?
 				sb->s_blocksize - offset : towrite;

-		tmp_bh.b_state = 0;
+		memset(&tmp_bh, 0, sizeof(struct buffer_head));
 		err = ext2_get_block(inode, blk, &tmp_bh, 1);
 		if (err < 0)
 			goto out;
-- 
1.5.4.3


Thanks -
Manish

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-26 13:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-20 17:06 [PATCH] : make sure the buffer head members are zeroed out before using them Manish Katiyar
2009-01-25 15:53 ` Manish Katiyar
2009-01-25 16:15   ` Eric Sandeen
2009-01-25 16:22     ` Manish Katiyar
2009-01-25 17:01       ` Eric Sandeen
2009-01-26 12:32       ` Jan Kara
2009-01-26 12:29   ` Jan Kara
2009-01-26 12:33     ` Manish Katiyar
2009-01-26 12:48       ` Manish Katiyar
2009-01-26 13:00         ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox