* [PATCH] Bluetooth: bnep: refactor deprecated strcpy
@ 2026-08-11 9:49 Ajith P V
2026-08-11 11:05 ` bluez.test.bot
2026-08-11 20:10 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Ajith P V @ 2026-08-11 9:49 UTC (permalink / raw)
To: marcel, luiz.dentz; +Cc: linux-bluetooth, linux-kernel, Ajith P V
The strcpy() function is deprecated across the kernel tree and
moving towards complete elimination. It provides no verification
limits against buffer overflows and does not guarantee strict boundary
restrictions [1][2].
Replace instances of strcpy() in `net/bluetooth/bnep/core.c` with the safer
strscpy() alternative. Since both target destination blocks are
statically allocated fixed-size arrays within their structure definitions,
leverage the compile time sizeof() operator to explicitly pass the
destination buffer capacities.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
Link: https://github.com/KSPP/linux/issues/88 [2]
Signed-off-by: Ajith P V <ajithpv.linux@gmail.com>
---
net/bluetooth/bnep/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index f7d88c33e23e..0dde82e9a085 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -670,7 +670,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
goto failed;
}
- strcpy(req->device, dev->name);
+ strscpy(req->device, dev->name, sizeof(req->device));
up_write(&bnep_session_sem);
return 0;
@@ -712,7 +712,7 @@ static void __bnep_copy_ci(struct bnep_conninfo *ci, struct bnep_session *s)
memset(ci, 0, sizeof(*ci));
memcpy(ci->dst, s->eh.h_source, ETH_ALEN);
- strcpy(ci->device, s->dev->name);
+ strscpy(ci->device, s->dev->name, sizeof(ci->device));
ci->flags = s->flags & valid_flags;
ci->state = s->state;
ci->role = s->role;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: bnep: refactor deprecated strcpy
2026-08-11 9:49 [PATCH] Bluetooth: bnep: refactor deprecated strcpy Ajith P V
@ 2026-08-11 11:05 ` bluez.test.bot
2026-08-11 20:10 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-08-11 11:05 UTC (permalink / raw)
To: linux-bluetooth, ajithpv.linux
[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1144013
---Test result---
Test Summary:
CheckPatch PASS 0.49 seconds
VerifyFixes PASS 0.09 seconds
VerifySignedoff PASS 3.21 seconds
GitLint PASS 3.54 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 21.03 seconds
CheckAllWarning PASS 23.13 seconds
CheckSparse PASS 22.89 seconds
BuildKernel32 PASS 20.37 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 378.17 seconds
TestRunner_bnep-tester PASS 16.23 seconds
IncrementalBuild PASS 22.84 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
https://github.com/bluez/bluetooth-next/pull/571
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: bnep: refactor deprecated strcpy
2026-08-11 9:49 [PATCH] Bluetooth: bnep: refactor deprecated strcpy Ajith P V
2026-08-11 11:05 ` bluez.test.bot
@ 2026-08-11 20:10 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-08-11 20:10 UTC (permalink / raw)
To: Ajith P V; +Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 11 Aug 2026 09:49:32 +0000 you wrote:
> The strcpy() function is deprecated across the kernel tree and
> moving towards complete elimination. It provides no verification
> limits against buffer overflows and does not guarantee strict boundary
> restrictions [1][2].
>
> Replace instances of strcpy() in `net/bluetooth/bnep/core.c` with the safer
> strscpy() alternative. Since both target destination blocks are
> statically allocated fixed-size arrays within their structure definitions,
> leverage the compile time sizeof() operator to explicitly pass the
> destination buffer capacities.
>
> [...]
Here is the summary with links:
- Bluetooth: bnep: refactor deprecated strcpy
https://git.kernel.org/bluetooth/bluetooth-next/c/6d5e3062ef68
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-11 20:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 9:49 [PATCH] Bluetooth: bnep: refactor deprecated strcpy Ajith P V
2026-08-11 11:05 ` bluez.test.bot
2026-08-11 20:10 ` [PATCH] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox