Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f386a70 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'akpm' (incoming from Andrew)

Merge a few more patches from Andrew Morton:
 "A few leftovers"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  fs/ncpfs/dir.c: fix indenting in ncp_lookup()
  ncpfs/inode.c: fix mismatch printk formats and arguments
  ncpfs: remove now unused PRINTK macro
  ncpfs: convert PPRINTK to ncp_vdbg
  ncpfs: convert DPRINTK/DDPRINTK to ncp_dbg
  ncpfs: Add pr_fmt and convert printks to pr_<level>
  arch/x86/mm/kmemcheck/kmemcheck.c: use kstrtoint() instead of sscanf()
  lib/percpu_counter.c: fix bad percpu counter state during suspend
  autofs4: check dev ioctl size before allocating
  mm: vmscan: do not swap anon pages just because free+file is low
parents ce7613db ffddc5fd
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -78,10 +78,16 @@ early_initcall(kmemcheck_init);
 */
static int __init param_kmemcheck(char *str)
{
	int val;
	int ret;

	if (!str)
		return -EINVAL;

	sscanf(str, "%d", &kmemcheck_enabled);
	ret = kstrtoint(str, 0, &val);
	if (ret)
		return ret;
	kmemcheck_enabled = val;
	return 0;
}

+3 −0
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
	if (tmp.size < sizeof(tmp))
		return ERR_PTR(-EINVAL);

	if (tmp.size > (PATH_MAX + sizeof(tmp)))
		return ERR_PTR(-ENAMETOOLONG);

	return memdup_user(in, tmp.size);
}

+32 −37
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
	if (val)
		goto finished;

	DDPRINTK("ncp_lookup_validate: %pd2 not valid, age=%ld, server lookup\n",
	ncp_dbg(2, "%pd2 not valid, age=%ld, server lookup\n",
		dentry, NCP_GET_AGE(dentry));

	len = sizeof(__name);
@@ -358,7 +358,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
			res = ncp_obtain_info(server, dir, __name, &(finfo.i));
	}
	finfo.volume = finfo.i.volNumber;
	DDPRINTK("ncp_lookup_validate: looked for %pd/%s, res=%d\n",
	ncp_dbg(2, "looked for %pd/%s, res=%d\n",
		dentry->d_parent, __name, res);
	/*
	 * If we didn't find it, or if it has a different dirEntNum to
@@ -372,14 +372,14 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
			ncp_new_dentry(dentry);
			val=1;
		} else
			DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
			ncp_dbg(2, "found, but dirEntNum changed\n");

		ncp_update_inode2(inode, &finfo);
		mutex_unlock(&inode->i_mutex);
	}

finished:
	DDPRINTK("ncp_lookup_validate: result=%d\n", val);
	ncp_dbg(2, "result=%d\n", val);
	dput(parent);
	return val;
}
@@ -453,8 +453,7 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx)
	ctl.page  = NULL;
	ctl.cache = NULL;

	DDPRINTK("ncp_readdir: reading %pD2, pos=%d\n", file,
		(int) ctx->pos);
	ncp_dbg(2, "reading %pD2, pos=%d\n", file, (int)ctx->pos);

	result = -EIO;
	/* Do not generate '.' and '..' when server is dead. */
@@ -697,8 +696,7 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
	struct ncp_entry_info entry;
	int i;

	DPRINTK("ncp_read_volume_list: pos=%ld\n",
			(unsigned long) ctx->pos);
	ncp_dbg(1, "pos=%ld\n", (unsigned long)ctx->pos);

	for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
		int inval_dentry;
@@ -708,12 +706,11 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
		if (!strlen(info.volume_name))
			continue;

		DPRINTK("ncp_read_volume_list: found vol: %s\n",
			info.volume_name);
		ncp_dbg(1, "found vol: %s\n", info.volume_name);

		if (ncp_lookup_volume(server, info.volume_name,
					&entry.i)) {
			DPRINTK("ncpfs: could not lookup vol %s\n",
			ncp_dbg(1, "could not lookup vol %s\n",
				info.volume_name);
			continue;
		}
@@ -738,14 +735,13 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx,
	int more;
	size_t bufsize;

	DPRINTK("ncp_do_readdir: %pD2, fpos=%ld\n", file,
		(unsigned long) ctx->pos);
	PPRINTK("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n",
	ncp_dbg(1, "%pD2, fpos=%ld\n", file, (unsigned long)ctx->pos);
	ncp_vdbg("init %pD, volnum=%d, dirent=%u\n",
		 file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);

	err = ncp_initialize_search(server, dir, &seq);
	if (err) {
		DPRINTK("ncp_do_readdir: init failed, err=%d\n", err);
		ncp_dbg(1, "init failed, err=%d\n", err);
		return;
	}
	/* We MUST NOT use server->buffer_size handshaked with server if we are
@@ -808,8 +804,7 @@ int ncp_conn_logged_in(struct super_block *sb)
			goto out;
		result = -ENOENT;
		if (ncp_get_volume_root(server, __name, &volNumber, &dirEntNum, &DosDirNum)) {
			PPRINTK("ncp_conn_logged_in: %s not found\n",
				server->m.mounted_vol);
			ncp_vdbg("%s not found\n", server->m.mounted_vol);
			goto out;
		}
		dent = sb->s_root;
@@ -822,10 +817,10 @@ int ncp_conn_logged_in(struct super_block *sb)
				NCP_FINFO(ino)->DosDirNum = DosDirNum;
				result = 0;
			} else {
				DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n");
				ncp_dbg(1, "sb->s_root->d_inode == NULL!\n");
			}
		} else {
			DPRINTK("ncpfs: sb->s_root == NULL!\n");
			ncp_dbg(1, "sb->s_root == NULL!\n");
		}
	} else
		result = 0;
@@ -846,7 +841,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
	if (!ncp_conn_valid(server))
		goto finished;

	PPRINTK("ncp_lookup: server lookup for %pd2\n", dentry);
	ncp_vdbg("server lookup for %pd2\n", dentry);

	len = sizeof(__name);
	if (ncp_is_server_root(dir)) {
@@ -862,7 +857,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
		if (!res)
			res = ncp_obtain_info(server, dir, __name, &(finfo.i));
	}
	PPRINTK("ncp_lookup: looked for %pd2, res=%d\n", dentry, res);
	ncp_vdbg("looked for %pd2, res=%d\n", dentry, res);
	/*
	 * If we didn't find an entry, make a negative dentry.
	 */
@@ -886,7 +881,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
	}

finished:
	PPRINTK("ncp_lookup: result=%d\n", error);
	ncp_vdbg("result=%d\n", error);
	return ERR_PTR(error);
}

@@ -909,7 +904,7 @@ static int ncp_instantiate(struct inode *dir, struct dentry *dentry,
	return error;

out_close:
	PPRINTK("ncp_instantiate: %pd2 failed, closing file\n", dentry);
	ncp_vdbg("%pd2 failed, closing file\n", dentry);
	ncp_close_file(NCP_SERVER(dir), finfo->file_handle);
	goto out;
}
@@ -923,7 +918,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
	int opmode;
	__u8 __name[NCP_MAXPATHLEN + 1];
	
	PPRINTK("ncp_create_new: creating %pd2, mode=%hx\n", dentry, mode);
	ncp_vdbg("creating %pd2, mode=%hx\n", dentry, mode);

	ncp_age_dentry(server, dentry);
	len = sizeof(__name);
@@ -952,7 +947,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
				error = -ENAMETOOLONG;
			else if (result < 0)
				error = result;
			DPRINTK("ncp_create: %pd2 failed\n", dentry);
			ncp_dbg(1, "%pd2 failed\n", dentry);
			goto out;
		}
		opmode = O_WRONLY;
@@ -985,7 +980,7 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
	int error, len;
	__u8 __name[NCP_MAXPATHLEN + 1];

	DPRINTK("ncp_mkdir: making %pd2\n", dentry);
	ncp_dbg(1, "making %pd2\n", dentry);

	ncp_age_dentry(server, dentry);
	len = sizeof(__name);
@@ -1022,7 +1017,7 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
	int error, result, len;
	__u8 __name[NCP_MAXPATHLEN + 1];

	DPRINTK("ncp_rmdir: removing %pd2\n", dentry);
	ncp_dbg(1, "removing %pd2\n", dentry);

	len = sizeof(__name);
	error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
@@ -1067,13 +1062,13 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
	int error;

	server = NCP_SERVER(dir);
	DPRINTK("ncp_unlink: unlinking %pd2\n", dentry);
	ncp_dbg(1, "unlinking %pd2\n", dentry);
	
	/*
	 * Check whether to close the file ...
	 */
	if (inode) {
		PPRINTK("ncp_unlink: closing file\n");
		ncp_vdbg("closing file\n");
		ncp_make_closed(inode);
	}

@@ -1087,7 +1082,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
#endif
	switch (error) {
		case 0x00:
			DPRINTK("ncp: removed %pd2\n", dentry);
			ncp_dbg(1, "removed %pd2\n", dentry);
			break;
		case 0x85:
		case 0x8A:
@@ -1120,7 +1115,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
	int old_len, new_len;
	__u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];

	DPRINTK("ncp_rename: %pd2 to %pd2\n", old_dentry, new_dentry);
	ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry);

	ncp_age_dentry(server, old_dentry);
	ncp_age_dentry(server, new_dentry);
@@ -1150,7 +1145,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
#endif
	switch (error) {
		case 0x00:
               	        DPRINTK("ncp renamed %pd -> %pd.\n",
			ncp_dbg(1, "renamed %pd -> %pd\n",
				old_dentry, new_dentry);
			break;
		case 0x9E:
@@ -1173,7 +1168,7 @@ static int ncp_mknod(struct inode * dir, struct dentry *dentry,
	if (!new_valid_dev(rdev))
		return -EINVAL;
	if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) {
		DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%ho\n", mode);
		ncp_dbg(1, "mode = 0%ho\n", mode);
		return ncp_create_new(dir, dentry, mode, rdev, 0);
	}
	return -EPERM; /* Strange, but true */
+13 −11
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
 *
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <asm/uaccess.h>

#include <linux/time.h>
@@ -34,11 +36,11 @@ int ncp_make_open(struct inode *inode, int right)

	error = -EINVAL;
	if (!inode) {
		printk(KERN_ERR "ncp_make_open: got NULL inode\n");
		pr_err("%s: got NULL inode\n", __func__);
		goto out;
	}

	DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
	ncp_dbg(1, "opened=%d, volume # %u, dir entry # %u\n",
		atomic_read(&NCP_FINFO(inode)->opened), 
		NCP_FINFO(inode)->volNumber, 
		NCP_FINFO(inode)->dirEntNum);
@@ -71,7 +73,7 @@ int ncp_make_open(struct inode *inode, int right)
				break;
		}
		if (result) {
			PPRINTK("ncp_make_open: failed, result=%d\n", result);
			ncp_vdbg("failed, result=%d\n", result);
			goto out_unlock;
		}
		/*
@@ -83,7 +85,7 @@ int ncp_make_open(struct inode *inode, int right)
	}

	access = NCP_FINFO(inode)->access;
	PPRINTK("ncp_make_open: file open, access=%x\n", access);
	ncp_vdbg("file open, access=%x\n", access);
	if (access == right || access == O_RDWR) {
		atomic_inc(&NCP_FINFO(inode)->opened);
		error = 0;
@@ -107,7 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
	void* freepage;
	size_t freelen;

	DPRINTK("ncp_file_read: enter %pd2\n", dentry);
	ncp_dbg(1, "enter %pd2\n", dentry);

	pos = *ppos;

@@ -124,7 +126,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

	error = ncp_make_open(inode, O_RDONLY);
	if (error) {
		DPRINTK(KERN_ERR "ncp_file_read: open failed, error=%d\n", error);
		ncp_dbg(1, "open failed, error=%d\n", error);
		return error;
	}

@@ -165,7 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

	file_accessed(file);

	DPRINTK("ncp_file_read: exit %pd2\n", dentry);
	ncp_dbg(1, "exit %pd2\n", dentry);
outrel:
	ncp_inode_close(inode);		
	return already_read ? already_read : error;
@@ -182,7 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
	int errno;
	void* bouncebuffer;

	DPRINTK("ncp_file_write: enter %pd2\n", dentry);
	ncp_dbg(1, "enter %pd2\n", dentry);
	if ((ssize_t) count < 0)
		return -EINVAL;
	pos = *ppos;
@@ -211,7 +213,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
		return 0;
	errno = ncp_make_open(inode, O_WRONLY);
	if (errno) {
		DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
		ncp_dbg(1, "open failed, error=%d\n", errno);
		return errno;
	}
	bufsize = NCP_SERVER(inode)->buffer_size;
@@ -261,7 +263,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
			i_size_write(inode, pos);
		mutex_unlock(&inode->i_mutex);
	}
	DPRINTK("ncp_file_write: exit %pd2\n", dentry);
	ncp_dbg(1, "exit %pd2\n", dentry);
outrel:
	ncp_inode_close(inode);		
	return already_written ? already_written : errno;
@@ -269,7 +271,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *

static int ncp_release(struct inode *inode, struct file *file) {
	if (ncp_make_closed(inode)) {
		DPRINTK("ncp_release: failed to close\n");
		ncp_dbg(1, "failed to close\n");
	}
	return 0;
}
+7 −5
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
 * getopt.c
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/string.h>

@@ -46,7 +48,7 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts
				if (opts->has_arg & OPT_NOPARAM) {
					return opts->val;
				}
				printk(KERN_INFO "%s: the %s option requires an argument\n",
				pr_info("%s: the %s option requires an argument\n",
					caller, token);
				return -EINVAL;
			}
@@ -57,18 +59,18 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts
				if (!*v) {
					return opts->val;
				}
				printk(KERN_INFO "%s: invalid numeric value in %s=%s\n",
				pr_info("%s: invalid numeric value in %s=%s\n",
					caller, token, val);
				return -EDOM;
			}
			if (opts->has_arg & OPT_STRING) {
				return opts->val;
			}
			printk(KERN_INFO "%s: unexpected argument %s to the %s option\n",
			pr_info("%s: unexpected argument %s to the %s option\n",
				caller, val, token);
			return -EINVAL;
		}
	}
	printk(KERN_INFO "%s: Unrecognized mount option %s\n", caller, token);
	pr_info("%s: Unrecognized mount option %s\n", caller, token);
	return -EOPNOTSUPP;
}
Loading