Re: [PATCH RESEND v2 00/30] proc: convert the fs, kernel and mm entries (Part 5/7)

From: Christian Brauner

Date: Mon Nov 09 2026 - 06:32:25 EST


On Fri, Nov 06, 2026 at 12:19:45PM -0800, Linus Torvalds wrote:
> Ahh, this all goes away in "scsi: core: let procfs copy in writes", so
> never mind.

Yeah, but we can still do what you say in the fix:

--- v2/drivers/scsi/scsi_proc.c
+++ v3/drivers/scsi/scsi_proc.c
@@ -66,24 +66,19 @@
size_t count, loff_t *ppos)
{
struct Scsi_Host *shost = pde_data(file_inode(file));
- ssize_t ret = -ENOMEM;
+ ssize_t ret;
char *page;
-
+
if (count > PROC_BLOCK_SIZE)
return -EOVERFLOW;

if (!shost->hostt->write_info)
return -EINVAL;

- page = kmalloc(PAGE_SIZE, GFP_KERNEL);
- if (page) {
- ret = -EFAULT;
- if (copy_from_user(page, buf, count))
- goto out;
- page[count] = '\0';
- ret = shost->hostt->write_info(shost, page, count);
- }
-out:
+ page = memdup_user_nul(buf, count);
+ if (IS_ERR(page))
+ return PTR_ERR(page);
+ ret = shost->hostt->write_info(shost, page, count);
kfree(page);
return ret;
}

--