All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Chengyu Song <csong84@gatech.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [patch] hfs: fix hfs_readdir()
Date: Tue, 26 Jan 2016 12:26:11 +0300	[thread overview]
Message-ID: <20160126092611.GD15717@mwanda> (raw)

I was looking through static analysis warnings and we seem to be copying
garbage into &rd->key.  This goes back to before the start of git...

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Not tested.  Please review carefully.

diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 70788e0..66485d7 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -163,7 +163,7 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)
 		rd->file = file;
 		list_add(&rd->list, &HFS_I(inode)->open_dir_list);
 	}
-	memcpy(&rd->key, &fd.key, sizeof(struct hfs_cat_key));
+	memcpy(&rd->key, &fd.key->cat, sizeof(struct hfs_cat_key));
 out:
 	hfs_find_exit(&fd);
 	return err;

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Chengyu Song <csong84@gatech.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [patch] hfs: fix hfs_readdir()
Date: Tue, 26 Jan 2016 09:26:11 +0000	[thread overview]
Message-ID: <20160126092611.GD15717@mwanda> (raw)

I was looking through static analysis warnings and we seem to be copying
garbage into &rd->key.  This goes back to before the start of git...

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Not tested.  Please review carefully.

diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 70788e0..66485d7 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -163,7 +163,7 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)
 		rd->file = file;
 		list_add(&rd->list, &HFS_I(inode)->open_dir_list);
 	}
-	memcpy(&rd->key, &fd.key, sizeof(struct hfs_cat_key));
+	memcpy(&rd->key, &fd.key->cat, sizeof(struct hfs_cat_key));
 out:
 	hfs_find_exit(&fd);
 	return err;

             reply	other threads:[~2016-01-26  9:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26  9:26 Dan Carpenter [this message]
2016-01-26  9:26 ` [patch] hfs: fix hfs_readdir() Dan Carpenter
2016-01-26 18:18 ` Viacheslav Dubeyko
2016-01-26 18:18   ` Viacheslav Dubeyko
2016-01-26 19:18   ` Dan Carpenter
2016-01-26 19:18     ` Dan Carpenter
2016-01-26 21:54     ` Viacheslav Dubeyko
2016-01-26 21:54       ` Viacheslav Dubeyko
2017-01-16 14:22       ` Dan Carpenter
2017-01-16 14:22         ` Dan Carpenter
2017-01-16 22:34         ` Viacheslav Dubeyko
2017-01-16 22:34           ` Viacheslav Dubeyko
2017-01-18 11:13           ` [patch resend] hfs: fix " Dan Carpenter
2017-01-18 11:13             ` Dan Carpenter
2017-01-18 17:28             ` Viacheslav Dubeyko
2017-01-18 17:28               ` Viacheslav Dubeyko

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=20160126092611.GD15717@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=csong84@gatech.edu \
    --cc=dhowells@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.