git: fc1c787aa015 - main - linux(4): Properly allocate buffer for kern_getdirentries in readdir
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Jul 2023 21:44:54 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=fc1c787aa0157090e765ebba484e6e290e99f177 commit fc1c787aa0157090e765ebba484e6e290e99f177 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-07-18 21:44:15 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-07-18 21:44:15 +0000 linux(4): Properly allocate buffer for kern_getdirentries in readdir Looks like prior to ino64 project the size of the struct linux_dirent was greater (or equal) to the size of the native struct dirent so the native dirent fit into the buffer. After ino64 project the size of the native struct dirent has increased. Spotted by gcc12. MFC after: 2 weeks --- sys/compat/linux/linux_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 4e8c3f435261..a5b8a4270dc0 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -560,7 +560,7 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args) struct l_dirent *linux_dirent; int buflen, error; - buflen = LINUX_RECLEN(LINUX_NAME_MAX); + buflen = sizeof(*bdp); buf = malloc(buflen, M_TEMP, M_WAITOK); error = kern_getdirentries(td, args->fd, buf, buflen,