[PATCH] remove getname32

From: Stephen Rothwell (sfr@canb.auug.org.au)
Date: Wed Jun 12 2002 - 00:55:35 EST


Hi Linus,

OK, arch/ppc64/kernel/sys_ppc32.c has a getname32 function. The only
difference between it and getname() is that it calls do_getname32()
instead of do_getname() (see fs/namei.c). The difference between
do_getname and do_getname32 is that the former checks to make sure that
the pointer it is passed is less that TASK_SIZE and restricts the length
copied to the lesser of PATH_MAX and (TASK_SIZE - pointer). do_getname32
uses PAGE_SIZE instead of PATH_MAX.

arch/ia64/ia32/sys_ia32.c defined a getname32(), but nothing used it.

This patch removes both.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.21/arch/ppc64/kernel/sys_ppc32.c 2.5.21-sfr.1/arch/ppc64/kernel/sys_ppc32.c --- 2.5.21/arch/ppc64/kernel/sys_ppc32.c Mon Jun 3 12:16:59 2002 +++ 2.5.21-sfr.1/arch/ppc64/kernel/sys_ppc32.c Wed Jun 12 15:42:25 2002 @@ -82,47 +82,6 @@ */ #define MSR_USERCHANGE (MSR_FE0 | MSR_FE1) -/* In order to reduce some races, while at the same time doing additional - * checking and hopefully speeding things up, we copy filenames to the - * kernel data space before using them.. - * - * POSIX.1 2.4: an empty pathname is invalid (ENOENT). - */ -static inline int do_getname32(const char *filename, char *page) -{ - int retval; - - /* 32bit pointer will be always far below TASK_SIZE :)) */ - retval = strncpy_from_user((char *)page, (char *)filename, PAGE_SIZE); - if (retval > 0) { - if (retval < PAGE_SIZE) - return 0; - return -ENAMETOOLONG; - } else if (!retval) - retval = -ENOENT; - return retval; -} - -char * getname32(const char *filename) -{ - char *tmp, *result; - - result = ERR_PTR(-ENOMEM); - tmp = __getname(); - if (tmp) { - int retval = do_getname32(filename, tmp); - - result = tmp; - if (retval < 0) { - putname(tmp); - result = ERR_PTR(retval); - } - } - return result; -} - - - extern asmlinkage long sys_utime(char * filename, struct utimbuf * times); struct utimbuf32 { @@ -142,7 +101,7 @@ return sys_utime(filename, NULL); if (get_user(t.actime, &times->actime) || __get_user(t.modtime, &times->modtime)) return -EFAULT; - filenam = getname32(filename); + filenam = getname(filename); ret = PTR_ERR(filenam); if (!IS_ERR(filenam)) { @@ -937,7 +896,7 @@ PPCDBG(PPCDBG_SYS32X, "sys32_statfs - entered - pid=%ld current=%lx comm=%s\n", current->pid, current, current->comm); - pth = getname32 (path); + pth = getname (path); ret = PTR_ERR(pth); if (!IS_ERR(pth)) { set_fs (KERNEL_DS); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:24 EST