From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] fs/compat: fix a bug in do_ncp_super_data_conv()
Date: Thu, 4 Feb 2016 14:40:09 +0300 [thread overview]
Message-ID: <20160204114009.GB11239@mwanda> (raw)
We are trying to copy the c_n->mounted_vol[] array and the three integer
struct members that follow it. The problem is that there is a 3 byte
struct hole after c_n->mounted_vol[] so we don't copy the lower 3 bytes
of c_n->flags.
I fixed it by doing the assignments one at a time.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/compat.c b/fs/compat.c
index a71936a..355ab04 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -693,7 +693,11 @@ static void *do_ncp_super_data_conv(void *raw_data)
n->file_mode = c_n->file_mode;
n->gid = c_n->gid;
n->uid = c_n->uid;
- memmove (n->mounted_vol, c_n->mounted_vol, (sizeof (c_n->mounted_vol) + 3 * sizeof (unsigned int)));
+ memmove(n->mounted_vol, c_n->mounted_vol,
+ sizeof(c_n->mounted_vol));
+ n->time_out = c_n->time_out;
+ n->retry_count = c_n->retry_count;
+ n->flags = c_n->flags;
n->wdog_pid = c_n->wdog_pid;
n->mounted_uid = c_n->mounted_uid;
} else if (version == 4) {
reply other threads:[~2016-02-04 11:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20160204114009.GB11239@mwanda \
--to=dan.carpenter@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).