All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] binder: use kstrdup() in binderfs_binder_device_create()
@ 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
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Dmitry Antipov @ 2025-06-26  7:30 UTC (permalink / raw)
  To: Carlos Llamas
  Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
	Tiffany Y . Yang, linux-kernel, Dmitry Antipov

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-15  7:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-26  7:30 [PATCH 1/2] binder: use kstrdup() in binderfs_binder_device_create() 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
2025-07-15  7:32 ` Alice Ryhl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.