Skip to content

Commit bcf1eed

Browse files
ardbiesheuvelwilldeacon
authored andcommitted
arm64: idreg-override: avoid strlen() to check for empty strings
strlen() is a costly way to decide whether a string is empty, as in that case, the first character will be NUL so we can check for that directly. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20231129111555.3594833-60-ardb@google.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent dc3f5aa commit bcf1eed

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/arm64/kernel/idreg-override.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static void __init match_options(const char *cmdline)
232232

233233
override = prel64_pointer(reg->override);
234234

235-
for (f = 0; strlen(reg->fields[f].name); f++) {
235+
for (f = 0; reg->fields[f].name[0] != '\0'; f++) {
236236
u64 shift = reg->fields[f].shift;
237237
u64 width = reg->fields[f].width ?: 4;
238238
u64 mask = GENMASK_ULL(shift + width - 1, shift);

0 commit comments

Comments
 (0)