Re: [PATCH RESEND v2 00/30] proc: convert the fs, kernel and mm entries (Part 5/7)
From: Linus Torvalds
Date: Fri Nov 06 2026 - 15:04:08 EST
On Wed, 4 Nov 2026 at 15:35, Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> > I resent once after I cleaned things up post RFC and I don't plan on
> > resending (one failed attempt due to my network dropping).
>
> A git tree with all of the patches can be found at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=work.procfs.cleanup
Thanks. Looking at it again, I now reacted to the PCI
proc_bus_pci_read() patch again, and decided that what I *really* hate
about it is that it uses those "unsigned int" variables in the first
place.
And even worse, proc_bus_pci_write() uses the signed "int" variables.
That's just wrong. It's all garbage. It shouldn't use "int" at all. I
think it's just that all this code is two decades+ old, and 64-bit
issues weren't a thing, and even "loff_t" was a newfangled interface
at the time.
"pos" should just be loff_t, and "size" and "cnt" should be "size_t".
Those are the correct types for those things. Not "unsigned int" and
certainly not "int".
And yeah, cfg_size in "struct pci_dev" really is "int", and that's an
independent issue and likely a bug in the PCI layer.
int pci_cfg_space_size(struct pci_dev *dev);
doesn't seem able to actually return signed values (I think it returns
either 256 or 4096), but "int" is still not a great type for it - and
the comparisons with proper variables like 'size_t' will then turn the
comparison unsigned anyway.
This is all ancient code that works, but isn't pretty. But I'd rather
fix the types than do things like
if (*ppos >= size)
return 0;
pos = *ppos;
which first does the comparison in the right type before it then
truncates it to the wrong one...
Linus