Re: [PATCH] stat: don't fail if the major number is >= 256
From: Linus Torvalds
Date: Tue Apr 12 2022 - 03:25:51 EST
On Mon, Apr 11, 2022 at 7:37 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Correct. It's literally the compat structure that has no basis in reality.
>
> Or it might be some truly ancient thing, but I really don't think so.
I was intrigued, so I went back and checked.
unsigned short st_dev;
unsigned short __pad1;
is in fact historical. But it was changed to
unsigned long st_dev;
(for i386, so this is a 32-bit 'unsigned long') on April 2, 2003.
>From the BK tree conversion:
https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=e95b2065677fe32512a597a79db94b77b90c968d
so I think we should just make sure that the 64-bit compat system call
is compatible with that 2003+ state, not with some truly ancient
state.
Linus