diff --git a/fs/proc/base.c b/fs/proc/base.c
index fe8d55fb17cc37da251cfd524dfc14dfb1711c72..89c20d9d50bfbf09c77aca8ca921885bb7eb0084 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -797,7 +797,7 @@ static ssize_t mem_read(struct file * file, char __user * buf,
 static ssize_t mem_write(struct file * file, const char * buf,
 			 size_t count, loff_t *ppos)
 {
-	int copied = 0;
+	int copied;
 	char *page;
 	struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
 	unsigned long dst = *ppos;
@@ -814,6 +814,7 @@ static ssize_t mem_write(struct file * file, const char * buf,
 	if (!page)
 		goto out;
 
+	copied = 0;
 	while (count > 0) {
 		int this_len, retval;