lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-436-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:19:35 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 435/437] fs: kill off non-iter variants of simple_attr_{read,write}*

They are no longer used, kill them with fire.

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 fs/libfs.c         | 89 ----------------------------------------------
 include/linux/fs.h |  6 ----
 2 files changed, 95 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index 56b404ad4cfb..74159f63334e 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1337,44 +1337,6 @@ int simple_attr_release(struct inode *inode, struct file *file)
 }
 EXPORT_SYMBOL_GPL(simple_attr_release);	/* GPL-only?  This?  Really? */
 
-/* read from the buffer that is filled with the get function */
-ssize_t simple_attr_read(struct file *file, char __user *buf,
-			 size_t len, loff_t *ppos)
-{
-	struct simple_attr *attr;
-	size_t size;
-	ssize_t ret;
-
-	attr = file->private_data;
-
-	if (!attr->get)
-		return -EACCES;
-
-	ret = mutex_lock_interruptible(&attr->mutex);
-	if (ret)
-		return ret;
-
-	if (*ppos && attr->get_buf[0]) {
-		/* continued read */
-		size = strlen(attr->get_buf);
-	} else {
-		/* first read */
-		u64 val;
-		ret = attr->get(attr->data, &val);
-		if (ret)
-			goto out;
-
-		size = scnprintf(attr->get_buf, sizeof(attr->get_buf),
-				 attr->fmt, (unsigned long long)val);
-	}
-
-	ret = simple_read_from_buffer(buf, len, ppos, attr->get_buf, size);
-out:
-	mutex_unlock(&attr->mutex);
-	return ret;
-}
-EXPORT_SYMBOL_GPL(simple_attr_read);
-
 /* read from the buffer that is filled with the get function */
 ssize_t simple_attr_read_iter(struct kiocb *iocb, struct iov_iter *to)
 {
@@ -1462,57 +1424,6 @@ ssize_t simple_attr_write_iter_signed(struct kiocb *iocb, struct iov_iter *from)
 }
 EXPORT_SYMBOL_GPL(simple_attr_write_iter_signed);
 
-/* interpret the buffer as a number to call the set function with */
-static ssize_t simple_attr_write_xsigned(struct file *file, const char __user *buf,
-			  size_t len, loff_t *ppos, bool is_signed)
-{
-	struct simple_attr *attr;
-	unsigned long long val;
-	size_t size;
-	ssize_t ret;
-
-	attr = file->private_data;
-	if (!attr->set)
-		return -EACCES;
-
-	ret = mutex_lock_interruptible(&attr->mutex);
-	if (ret)
-		return ret;
-
-	ret = -EFAULT;
-	size = min(sizeof(attr->set_buf) - 1, len);
-	if (copy_from_user(attr->set_buf, buf, size))
-		goto out;
-
-	attr->set_buf[size] = '\0';
-	if (is_signed)
-		ret = kstrtoll(attr->set_buf, 0, &val);
-	else
-		ret = kstrtoull(attr->set_buf, 0, &val);
-	if (ret)
-		goto out;
-	ret = attr->set(attr->data, val);
-	if (ret == 0)
-		ret = len; /* on success, claim we got the whole input */
-out:
-	mutex_unlock(&attr->mutex);
-	return ret;
-}
-
-ssize_t simple_attr_write(struct file *file, const char __user *buf,
-			  size_t len, loff_t *ppos)
-{
-	return simple_attr_write_xsigned(file, buf, len, ppos, false);
-}
-EXPORT_SYMBOL_GPL(simple_attr_write);
-
-ssize_t simple_attr_write_signed(struct file *file, const char __user *buf,
-			  size_t len, loff_t *ppos)
-{
-	return simple_attr_write_xsigned(file, buf, len, ppos, true);
-}
-EXPORT_SYMBOL_GPL(simple_attr_write_signed);
-
 /**
  * generic_encode_ino32_fh - generic export_operations->encode_fh function
  * @inode:   the object to encode
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 85db7dde4778..55fc02b99cf6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3552,12 +3552,6 @@ int simple_attr_open(struct inode *inode, struct file *file,
 		     int (*get)(void *, u64 *), int (*set)(void *, u64),
 		     const char *fmt);
 int simple_attr_release(struct inode *inode, struct file *file);
-ssize_t simple_attr_read(struct file *file, char __user *buf,
-			 size_t len, loff_t *ppos);
-ssize_t simple_attr_write(struct file *file, const char __user *buf,
-			  size_t len, loff_t *ppos);
-ssize_t simple_attr_write_signed(struct file *file, const char __user *buf,
-				 size_t len, loff_t *ppos);
 ssize_t simple_attr_read_iter(struct kiocb *iocb, struct iov_iter *to);
 ssize_t simple_attr_write_iter(struct kiocb *iocb, struct iov_iter *from);
 ssize_t simple_attr_write_iter_signed(struct kiocb *iocb, struct iov_iter *from);
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ