[PATCH] namei: use QSTR() instead of QSTR_INIT() in path_pts

Thorsten Blum posted 1 patch 1 month, 3 weeks ago
There is a newer version of this series
fs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] namei: use QSTR() instead of QSTR_INIT() in path_pts
Posted by Thorsten Blum 1 month, 3 weeks ago
Drop the hard-coded length argument and use the simpler QSTR().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index c7fac83c9a85..817bba800d7b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3617,7 +3617,7 @@ int path_pts(struct path *path)
 	 */
 	struct dentry *parent = dget_parent(path->dentry);
 	struct dentry *child;
-	struct qstr this = QSTR_INIT("pts", 3);
+	struct qstr this = QSTR("pts");
 
 	if (unlikely(!path_connected(path->mnt, parent))) {
 		dput(parent);
Re: [PATCH] namei: use QSTR() instead of QSTR_INIT() in path_pts
Posted by Al Viro 1 month, 3 weeks ago
On Wed, Apr 22, 2026 at 02:30:03PM +0200, Thorsten Blum wrote:
> Drop the hard-coded length argument and use the simpler QSTR().
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  fs/namei.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index c7fac83c9a85..817bba800d7b 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -3617,7 +3617,7 @@ int path_pts(struct path *path)
>  	 */
>  	struct dentry *parent = dget_parent(path->dentry);
>  	struct dentry *child;
> -	struct qstr this = QSTR_INIT("pts", 3);
> +	struct qstr this = QSTR("pts");
>  
>  	if (unlikely(!path_connected(path->mnt, parent))) {
>  		dput(parent);

NAK.  Compound literal is an l-value, so let's just use it:
	child = d_hash_and_lookup(parent, &QSTR("pts"));
and to hell with the local variable.
Re: [PATCH] namei: use QSTR() instead of QSTR_INIT() in path_pts
Posted by Jan Kara 1 month, 3 weeks ago
On Wed 22-04-26 14:30:03, Thorsten Blum wrote:
> Drop the hard-coded length argument and use the simpler QSTR().
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/namei.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index c7fac83c9a85..817bba800d7b 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -3617,7 +3617,7 @@ int path_pts(struct path *path)
>  	 */
>  	struct dentry *parent = dget_parent(path->dentry);
>  	struct dentry *child;
> -	struct qstr this = QSTR_INIT("pts", 3);
> +	struct qstr this = QSTR("pts");
>  
>  	if (unlikely(!path_connected(path->mnt, parent))) {
>  		dput(parent);
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR