mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Carlos Llamas <cmllamas@google.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: "Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Tiffany Y . Yang" <ynaffit@google.com>,
	linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 1/2] binder: use kstrdup() in binderfs_binder_device_create()
Date: Tue, 15 Jul 2025 03:45:07 +0000	[thread overview]
Message-ID: <aHXOw6DVD1AB5aIo@google.com> (raw)
In-Reply-To: <20250626073054.7706-1-dmantipov@yandex.ru>

On Thu, Jun 26, 2025 at 10:30:53AM +0300, Dmitry Antipov wrote:
> In 'binderfs_binder_device_create()', use 'kstrdup()' to copy the
> newly created device's name, thus making the former a bit simpler.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>  drivers/android/binderfs.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> index 024275dbfdd8..4f827152d18e 100644
> --- a/drivers/android/binderfs.c
> +++ b/drivers/android/binderfs.c
> @@ -117,7 +117,6 @@ static int binderfs_binder_device_create(struct inode *ref_inode,
>  	struct dentry *dentry, *root;
>  	struct binder_device *device;
>  	char *name = NULL;
> -	size_t name_len;
>  	struct inode *inode = NULL;
>  	struct super_block *sb = ref_inode->i_sb;
>  	struct binderfs_info *info = sb->s_fs_info;
> @@ -161,9 +160,7 @@ static int binderfs_binder_device_create(struct inode *ref_inode,
>  	inode->i_gid = info->root_gid;
>  
>  	req->name[BINDERFS_MAX_NAME] = '\0'; /* NUL-terminate */
> -	name_len = strlen(req->name);
> -	/* Make sure to include terminating NUL byte */
> -	name = kmemdup(req->name, name_len + 1, GFP_KERNEL);
> +	name = kstrdup(req->name, GFP_KERNEL);
>  	if (!name)
>  		goto err;
>  
> -- 
> 2.50.0
> 

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks Dimitry,

Acked-by: Carlos Llamas <cmllamas@google.com>


  parent reply	other threads:[~2025-07-15  3:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26  7:30 Dmitry Antipov
2025-06-26  7:30 ` [PATCH 2/2] binder: use guards for plain mutex- and spinlock-protected sections Dmitry Antipov
2025-07-15  3:51   ` Carlos Llamas
2025-07-15  7:38   ` Alice Ryhl
2025-06-26 17:30 ` [PATCH 1/2] binder: use kstrdup() in binderfs_binder_device_create() Tiffany Yang
2025-07-15  3:45 ` Carlos Llamas [this message]
2025-07-15  7:32 ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aHXOw6DVD1AB5aIo@google.com \
    --to=cmllamas@google.com \
    --cc=arve@android.com \
    --cc=dmantipov@yandex.ru \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=tkjos@android.com \
    --cc=ynaffit@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®