mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
powerpc/pseries: Avoid strlen() in do_{remove,update}_property()
Check only the first byte instead of scanning the entire string with strlen(). Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260721155346.121975-4-thorsten.blum@linux.dev
This commit is contained in:
parent
86bb4d74da
commit
903cc6e454
|
|
@ -307,7 +307,7 @@ static int do_remove_property(char *buf, size_t bufsize)
|
|||
if (tmp)
|
||||
*tmp = '\0';
|
||||
|
||||
if (strlen(buf) == 0)
|
||||
if (*buf == '\0')
|
||||
return -EINVAL;
|
||||
|
||||
return of_remove_property(np, of_find_property(np, buf, NULL));
|
||||
|
|
@ -330,7 +330,7 @@ static int do_update_property(char *buf, size_t bufsize)
|
|||
if (!next_prop)
|
||||
return -EINVAL;
|
||||
|
||||
if (!strlen(name))
|
||||
if (*name == '\0')
|
||||
return -ENODEV;
|
||||
|
||||
newprop = new_property(name, length, value, NULL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user