All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Coywolf Qi Hunt" <coywolf@lovecn.org>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [patch] add copy_to_user result check
Date: Sun, 17 Jul 2005 17:02:45 +0800	[thread overview]
Message-ID: <20050717090245.GA20667@gmail.com> (raw)

hello,

GCC warns me this problem. This patch adds copy_to_user result check
in sys_select() and sys_pselect7().


Signed-off-by: Coywolf Qi Hunt <coywolf@lovecn.org>
---
diff -pruN 2.6.13-rc3-mm1/fs/select.c 2.6.13-rc3-mm1-cy1/fs/select.c
--- 2.6.13-rc3-mm1/fs/select.c	2005-07-15 23:51:35.000000000 +0800
+++ 2.6.13-rc3-mm1-cy1/fs/select.c	2005-07-17 16:26:58.000000000 +0800
@@ -401,7 +401,8 @@ asmlinkage long sys_select(int n, fd_set
 			tv.tv_sec++;
 			tv.tv_usec -= 1000000;
 		}
-		copy_to_user(tvp, &tv, sizeof(tv));
+		if (copy_to_user(tvp, &tv, sizeof(tv)))
+			return -EFAULT;
 	}
 
 	return ret;
@@ -459,7 +460,8 @@ asmlinkage long sys_pselect7(int n, fd_s
 			ts.tv_sec++;
 			ts.tv_nsec -= 1000000000;
 		}
-		copy_to_user(tsp, &ts, sizeof(ts));
+		if (copy_to_user(tsp, &ts, sizeof(ts)))
+			return -EFAULT;
 	}
 
 	if (sigmask)

                 reply	other threads:[~2005-07-17  9:02 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=20050717090245.GA20667@gmail.com \
    --to=coywolf@lovecn.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.