Documentation: locking.rst: update deprecated function

replace strcpy() with strscpy() as suggested in deprecated.rst

Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20260531175452.272136-2-manuelebner@mailbox.org>
This commit is contained in:
Manuel Ebner 2026-05-31 19:54:53 +02:00 committed by Jonathan Corbet
parent 285257a806
commit 7e35a46588

View File

@ -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);