Skip to contentSkip to conversation

Documentation: locking.rst: update deprecated function

PATCH In review Manuel Ebner 2 participants 2 messages May 31 – Jun 30 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: locking.rst: update deprecated function

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

---
 Documentation/kernel-hacking/locking.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/kernel-hacking/locking.rst +3 -3
index dff0646a717b..d625b522265a 100644
@@ -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);
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 6 lines · Manuel Ebner

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

---
 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