Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97159
b: refs/heads/master
c: 79bc12a
h: refs/heads/master
i:
  97157: ef77515
  97155: 11b18a1
  97151: f17641d
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed May 21, 2008
1 parent 4910522 commit 4915060
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ec7ffa2df247054d422b48148ad82369a45e986
refs/heads/master: 79bc12a0a09c2eb1ccbb01c192045f994567bda2
26 changes: 12 additions & 14 deletions trunk/fs/ecryptfs/miscdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count,
struct ecryptfs_daemon *daemon;
struct ecryptfs_msg_ctx *msg_ctx;
size_t packet_length_size;
u32 counter_nbo;
char packet_length[3];
size_t i;
size_t total_length;
Expand Down Expand Up @@ -328,20 +327,18 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count,
"pending message\n", __func__, count, total_length);
goto out_unlock_msg_ctx;
}
i = 0;
buf[i++] = msg_ctx->type;
counter_nbo = cpu_to_be32(msg_ctx->counter);
memcpy(&buf[i], (char *)&counter_nbo, 4);
i += 4;
rc = -EFAULT;
if (put_user(msg_ctx->type, buf))
goto out_unlock_msg_ctx;
if (put_user(cpu_to_be32(msg_ctx->counter), (__be32 __user *)(buf + 1)))
goto out_unlock_msg_ctx;
i = 5;
if (msg_ctx->msg) {
memcpy(&buf[i], packet_length, packet_length_size);
if (copy_to_user(&buf[i], packet_length, packet_length_size))
goto out_unlock_msg_ctx;
i += packet_length_size;
rc = copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size);
if (rc) {
printk(KERN_ERR "%s: copy_to_user returned error "
"[%d]\n", __func__, rc);
if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size))
goto out_unlock_msg_ctx;
}
i += msg_ctx->msg_size;
}
rc = i;
Expand Down Expand Up @@ -452,7 +449,8 @@ static ssize_t
ecryptfs_miscdev_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
u32 counter_nbo, seq;
__be32 counter_nbo;
u32 seq;
size_t packet_size, packet_size_length, i;
ssize_t sz = 0;
char *data;
Expand Down Expand Up @@ -485,7 +483,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
count);
goto out_free;
}
memcpy((char *)&counter_nbo, &data[i], 4);
memcpy(&counter_nbo, &data[i], 4);
seq = be32_to_cpu(counter_nbo);
i += 4;
rc = ecryptfs_parse_packet_length(&data[i], &packet_size,
Expand Down

0 comments on commit 4915060

Please sign in to comment.