linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] initramfs: refactor clean_path()
Date: Thu, 19 Aug 2010 12:37:41 +0900	[thread overview]
Message-ID: <1282189064-3904-2-git-send-email-namhyung@gmail.com> (raw)
In-Reply-To: <1282189064-3904-1-git-send-email-namhyung@gmail.com>

first param, path, is used only on calling syscall routines which means it is
always considered as a user pointer. So add __user markup on parameter
declaration. And &st should be a user pointer also, mark it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 init/initramfs.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index d9c6e78..75a43c5 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -276,11 +276,12 @@ static int __init maybe_link(void)
 	return 0;
 }
 
-static void __init clean_path(char *path, mode_t mode)
+static void __init clean_path(char __user *path, mode_t mode)
 {
 	struct stat st;
 
-	if (!sys_newlstat(path, &st) && (st.st_mode^mode) & S_IFMT) {
+	if (!sys_newlstat(path, (struct stat __user __force *)&st) &&
+	    (st.st_mode^mode) & S_IFMT) {
 		if (S_ISDIR(st.st_mode))
 			sys_rmdir(path);
 		else
-- 
1.7.0.4


  reply	other threads:[~2010-08-19  3:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19  3:37 [PATCH 0/4] initramfs: remove sparse warnings Namhyung Kim
2010-08-19  3:37 ` Namhyung Kim [this message]
2010-08-19  3:37 ` [PATCH 2/4] initramfs: mark dirp as a __user pointer on clean_rootfs() Namhyung Kim
2010-08-19  3:37 ` [PATCH 3/4] initramfs: mark collect buffers as __user pointers Namhyung Kim
2010-08-19  3:37 ` [PATCH 4/4] initramfs: add missing __user markup Namhyung Kim
2010-08-19 14:38 ` [PATCH 0/4] initramfs: remove sparse warnings Arnd Bergmann
2010-08-19 16:57   ` Namhyung Kim
2010-08-20 12:00   ` Al Viro
2010-08-20 15:36     ` Namhyung Kim
2010-08-22 20:33       ` Arnd Bergmann
2010-08-23 14:59         ` Namhyung Kim

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=1282189064-3904-2-git-send-email-namhyung@gmail.com \
    --to=namhyung@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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 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).