git: 1821249a4d70 - stable/13 - linux(4): Delete a useless variable in readdir

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Mon, 07 Aug 2023 14:24:15 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=1821249a4d70fd8732f6f0eef42b3cbe0fe03f5f

commit 1821249a4d70fd8732f6f0eef42b3cbe0fe03f5f
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-07-18 21:44:15 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-08-07 14:22:58 +0000

    linux(4): Delete a useless variable in readdir
    
    MFC after:              2 weeks
    
    (cherry picked from commit fffb2e8de691ba6677616f7e0e5c442f4e7e722a)
---
 sys/compat/linux/linux_file.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 0def70e70581..3e1b5299cf0b 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -598,9 +598,8 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args)
 	struct dirent *bdp;
 	caddr_t buf;			/* BSD-format */
 	int linuxreclen;		/* Linux-format */
-	caddr_t lbuf;			/* Linux-format */
 	off_t base;
-	struct l_dirent *linux_dirent;
+	struct l_dirent *linux_dirent;	/* Linux-format */
 	int buflen, error;
 
 	buflen = sizeof(*bdp);
@@ -615,12 +614,12 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args)
 	if (td->td_retval[0] == 0)
 		goto out;
 
-	lbuf = malloc(LINUX_RECLEN(LINUX_NAME_MAX), M_TEMP, M_WAITOK | M_ZERO);
+	linux_dirent = malloc(LINUX_RECLEN(LINUX_NAME_MAX), M_TEMP,
+	    M_WAITOK | M_ZERO);
 
 	bdp = (struct dirent *) buf;
 	linuxreclen = LINUX_RECLEN(bdp->d_namlen);
 
-	linux_dirent = (struct l_dirent*)lbuf;
 	linux_dirent->d_ino = bdp->d_fileno;
 	linux_dirent->d_off = bdp->d_off;
 	linux_dirent->d_reclen = bdp->d_namlen;
@@ -630,7 +629,7 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args)
 	if (error == 0)
 		td->td_retval[0] = linuxreclen;
 
-	free(lbuf, M_TEMP);
+	free(linux_dirent, M_TEMP);
 out:
 	free(buf, M_TEMP);
 	return (error);