Merge to Fedora kernel-2.6.7-1.492
[linux-2.6.git] / fs / proc / base.c
index 9db204e..1427f01 100644 (file)
@@ -1510,7 +1510,8 @@ static struct inode_operations proc_tid_attr_inode_operations = {
 /*
  * /proc/self:
  */
-static int proc_self_readlink(struct dentry *dentry, char *buffer, int buflen)
+static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
+                             int buflen)
 {
        char tmp[30];
        sprintf(tmp, "%d", current->tgid);
@@ -1572,6 +1573,7 @@ struct dentry *proc_pid_unhash(struct task_struct *p)
        
 void proc_pid_flush(struct dentry *proc_dentry)
 {
+       might_sleep();
        if(proc_dentry != NULL) {
                shrink_dcache_parent(proc_dentry);
                dput(proc_dentry);
@@ -1803,7 +1805,9 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
                ino_t ino = fake_ino(tgid,PROC_TGID_INO);
                unsigned long j = PROC_NUMBUF;
 
-               do buf[--j] = '0' + (tgid % 10); while (tgid/=10);
+               do
+                       buf[--j] = '0' + (tgid % 10);
+               while ((tgid /= 10) != 0);
 
                if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino, DT_DIR) < 0) {
                        filp->f_version = tgid;
@@ -1858,7 +1862,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
 
                do
                        buf[--j] = '0' + (tid % 10);
-               while (tid /= 10);
+               while ((tid /= 10) != 0);
 
                if (filldir(dirent, buf+j, PROC_NUMBUF-j, pos, ino, DT_DIR) < 0)
                        break;