linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] fs/compat: fix a bug in do_ncp_super_data_conv()
@ 2016-02-04 11:40 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-02-04 11:40 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel, kernel-janitors

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) {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-04 11:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-04 11:40 [patch] fs/compat: fix a bug in do_ncp_super_data_conv() Dan Carpenter

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).