From: Jeff Liu <jeff.liu@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [patch v3] ocfs2: ocfs2: fix recent memory corruption bug
Date: Fri, 02 Aug 2013 09:39:21 +0800 [thread overview]
Message-ID: <51FB0DC9.4060904@oracle.com> (raw)
In-Reply-To: <20130801153638.GA4887@elgon.mountain>
On 08/01/2013 11:36 PM, Dan Carpenter wrote:
> The pointer math in 6fdf3af1d2 "ocfs2: fix null pointer dereference in
> ocfs2_dir_foreach_blk_id()" isn't correct so it will zero out the wrong
> memory. In fact, the memset isn't needed because the initializer will
> set all these values to zero.
>
> This patch also removes the "ctx.pos = 0" initialization because that
> will be zeroed automatically as well.
Looks good, thank you for correcting my previous mistake.
Acked-by: Jie Liu <jeff.liu@oracle.com>
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: remove the memset
> v3: remove the ctx.pos = 0.
>
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index c91d986..30544ce 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -2154,12 +2154,8 @@ int ocfs2_empty_dir(struct inode *inode)
> int ret;
> struct ocfs2_empty_dir_priv priv = {
> .ctx.actor = ocfs2_empty_dir_filldir,
> - .ctx.pos = 0,
> };
>
> - memset(&priv + sizeof(struct dir_context), 0,
> - sizeof(priv) - sizeof(struct dir_context));
> -
> if (ocfs2_dir_indexed(inode)) {
> ret = ocfs2_empty_dir_dx(inode, &priv);
> if (ret)
prev parent reply other threads:[~2013-08-02 1:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 13:55 [Ocfs2-devel] [patch] ocfs2: fix recent memory corruption bug Dan Carpenter
2013-08-01 13:58 ` Dan Carpenter
2013-08-01 14:02 ` [Ocfs2-devel] [patch v2] " Dan Carpenter
2013-08-01 14:11 ` Jeff Liu
2013-08-01 15:36 ` [Ocfs2-devel] [patch v3] ocfs2: " Dan Carpenter
2013-08-02 1:39 ` Jeff Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51FB0DC9.4060904@oracle.com \
--to=jeff.liu@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox