* [PATCH] Documentation: locking.rst: update deprecated function
@ 2026-05-31 17:54 Manuel Ebner
2026-06-30 20:04 ` Jonathan Corbet
0 siblings, 1 reply; 2+ messages in thread
From: Manuel Ebner @ 2026-05-31 17:54 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Manuel Ebner, linux-doc,
linux-kernel
replace strcpy() with strscpy() as suggested in deprecated.rst
Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
---
Documentation/kernel-hacking/locking.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kernel-hacking/locking.rst
index dff0646a717b..d625b522265a 100644
--- a/Documentation/kernel-hacking/locking.rst
+++ b/Documentation/kernel-hacking/locking.rst
@@ -471,7 +471,7 @@ to protect the cache and all the objects within it. Here's the code::
obj = __cache_find(id);
if (obj) {
ret = 0;
- strcpy(name, obj->name);
+ strscpy(name, obj->name);
}
mutex_unlock(&cache_lock);
return ret;
@@ -553,7 +553,7 @@ which are taken away, and the ``+`` are lines which are added.
obj = __cache_find(id);
if (obj) {
ret = 0;
- strcpy(name, obj->name);
+ strscpy(name, obj->name);
}
- mutex_unlock(&cache_lock);
+ spin_unlock_irqrestore(&cache_lock, flags);
@@ -676,7 +676,7 @@ Here is the code::
obj = __cache_find(id);
- if (obj) {
- ret = 0;
- - strcpy(name, obj->name);
+ - strscpy(name, obj->name);
- }
+ if (obj)
+ __object_get(obj);
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Documentation: locking.rst: update deprecated function
2026-05-31 17:54 [PATCH] Documentation: locking.rst: update deprecated function Manuel Ebner
@ 2026-06-30 20:04 ` Jonathan Corbet
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2026-06-30 20:04 UTC (permalink / raw)
To: Manuel Ebner, Shuah Khan, Manuel Ebner, linux-doc, linux-kernel
Manuel Ebner <manuelebner@mailbox.org> writes:
> replace strcpy() with strscpy() as suggested in deprecated.rst
>
> Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
> ---
> Documentation/kernel-hacking/locking.rst | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
I've applied this, but that stuff is so old I wonder how much value it
still has...
jon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-30 20:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-31 17:54 [PATCH] Documentation: locking.rst: update deprecated function Manuel Ebner
2026-06-30 20:04 ` Jonathan Corbet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox