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

Commit 581bfce9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull more set_fs removal from Al Viro:
 "Christoph's 'use kernel_read and friends rather than open-coding
  set_fs()' series"

* 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs: unexport vfs_readv and vfs_writev
  fs: unexport vfs_read and vfs_write
  fs: unexport __vfs_read/__vfs_write
  lustre: switch to kernel_write
  gadget/f_mass_storage: stop messing with the address limit
  mconsole: switch to kernel_read
  btrfs: switch write_buf to kernel_write
  net/9p: switch p9_fd_read to kernel_write
  mm/nommu: switch do_mmap_private to kernel_read
  serial2002: switch serial2002_tty_write to kernel_{read/write}
  fs: make the buf argument to __kernel_write a void pointer
  fs: fix kernel_write prototype
  fs: fix kernel_read prototype
  fs: move kernel_read to fs/read_write.c
  fs: move kernel_write to fs/read_write.c
  autofs4: switch autofs4_write to __kernel_write
  ashmem: switch to ->read_iter
parents cc73fee0 9725d4ce
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf,
	bool elf32;
	u32 flags;
	int ret;
	loff_t pos;

	elf32 = ehdr->e32.e_ident[EI_CLASS] == ELFCLASS32;
	flags = elf32 ? ehdr->e32.e_flags : ehdr->e64.e_flags;
@@ -108,21 +109,16 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf,

		if (phdr32->p_filesz < sizeof(abiflags))
			return -EINVAL;

		ret = kernel_read(elf, phdr32->p_offset,
				  (char *)&abiflags,
				  sizeof(abiflags));
		pos = phdr32->p_offset;
	} else {
		if (phdr64->p_type != PT_MIPS_ABIFLAGS)
			return 0;
		if (phdr64->p_filesz < sizeof(abiflags))
			return -EINVAL;

		ret = kernel_read(elf, phdr64->p_offset,
				  (char *)&abiflags,
				  sizeof(abiflags));
		pos = phdr64->p_offset;
	}

	ret = kernel_read(elf, &abiflags, sizeof(abiflags), &pos);
	if (ret < 0)
		return ret;
	if (ret != sizeof(abiflags))
+1 −6
Original line number Diff line number Diff line
@@ -148,12 +148,7 @@ void mconsole_proc(struct mc_request *req)
	}

	do {
		loff_t pos = file->f_pos;
		mm_segment_t old_fs = get_fs();
		set_fs(KERNEL_DS);
		len = vfs_read(file, buf, PAGE_SIZE - 1, &pos);
		set_fs(old_fs);
		file->f_pos = pos;
		len = kernel_read(file, buf, PAGE_SIZE - 1, &file->f_pos);
		if (len < 0) {
			mconsole_reply(req, "Read of file failed", 1, 0);
			goto out_free;
+2 −2
Original line number Diff line number Diff line
@@ -407,10 +407,10 @@ static int load_aout_library(struct file *file)
	unsigned long bss, start_addr, len, error;
	int retval;
	struct exec ex;

	loff_t pos = 0;

	retval = -ENOEXEC;
	error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
	error = kernel_read(file, &ex, sizeof(ex), &pos);
	if (error != sizeof(ex))
		goto out;

+5 −8
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ static int cx25821_get_audio_data(struct cx25821_dev *dev,
		p = (char *)dev->_audiodata_buf_virt_addr + frame_offset;

	for (i = 0; i < dev->_audio_lines_count; i++) {
		int n = kernel_read(file, file_offset, mybuf, AUDIO_LINE_SIZE);
		int n = kernel_read(file, mybuf, AUDIO_LINE_SIZE, &file_offset);
		if (n < AUDIO_LINE_SIZE) {
			pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
				__func__);
@@ -290,7 +290,6 @@ static int cx25821_get_audio_data(struct cx25821_dev *dev,
			memcpy(p, mybuf, n);
			p += n;
		}
		file_offset += n;
	}
	dev->_audioframe_count++;
	fput(file);
@@ -318,7 +317,7 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,
{
	char *p = (void *)dev->_audiodata_buf_virt_addr;
	struct file *file;
	loff_t offset;
	loff_t file_offset = 0;
	int i, j;

	file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
@@ -328,11 +327,11 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,
		return PTR_ERR(file);
	}

	for (j = 0, offset = 0; j < NUM_AUDIO_FRAMES; j++) {
	for (j = 0; j < NUM_AUDIO_FRAMES; j++) {
		for (i = 0; i < dev->_audio_lines_count; i++) {
			char buf[AUDIO_LINE_SIZE];
			int n = kernel_read(file, offset, buf,
						AUDIO_LINE_SIZE);
			loff_t offset = file_offset;
			int n = kernel_read(file, buf, AUDIO_LINE_SIZE, &file_offset);

			if (n < AUDIO_LINE_SIZE) {
				pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
@@ -344,8 +343,6 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,

			if (p)
				memcpy(p + offset, buf, n);

			offset += n;
		}
		dev->_audioframe_count++;
	}
+2 −2
Original line number Diff line number Diff line
@@ -1356,7 +1356,7 @@ static ssize_t read_file(struct nandsim *ns, struct file *file, void *buf, size_
	if (err)
		return err;
	noreclaim_flag = memalloc_noreclaim_save();
	tx = kernel_read(file, pos, buf, count);
	tx = kernel_read(file, buf, count, &pos);
	memalloc_noreclaim_restore(noreclaim_flag);
	put_pages(ns);
	return tx;
@@ -1372,7 +1372,7 @@ static ssize_t write_file(struct nandsim *ns, struct file *file, void *buf, size
	if (err)
		return err;
	noreclaim_flag = memalloc_noreclaim_save();
	tx = kernel_write(file, buf, count, pos);
	tx = kernel_write(file, buf, count, &pos);
	memalloc_noreclaim_restore(noreclaim_flag);
	put_pages(ns);
	return tx;
Loading