[PATCH v1 0/2] Add strprefix() and fix a bug with it
From: Alejandro Colomar
Date: Thu Nov 05 2026 - 06:21:02 EST
Hi!
str_has_prefix() is based on sizes and lengths, which means it must
overload the valid length 0 to mean not found. This is a typical
consequence of choosing to design an API around sizes and lengths, and
vanishes when moving to pointer-based similar APIs.
This patch set adds strprefix(), deprecates str_has_prefix(), and uses
strprefix() in one place to fix a bug reported by Bartosz.
We can later work on replacing the other uses of str_has_prefix(), which
might hide similar bugs.
Testing
~~~~~~~
I've built this patch set with 'allmodconfig'. I've not run the
resulting kernel, though.
Have a lovely day!
Alex
Alejandro Colomar (2):
string: Add strprefix(), and deprecate str_has_prefix()
device property: Fix fwnode_name_eq() for empty node names
drivers/base/property.c | 5 +----
include/linux/string.h | 19 ++++++++++++++++++-
2 files changed, 19 insertions(+), 5 deletions(-)
Range-diff against v0:
-: ------------ > 1: 9c81f6f62fd0 string: Add strprefix(), and deprecate str_has_prefix()
-: ------------ > 2: 37eafcd682b0 device property: Fix fwnode_name_eq() for empty node names
--
2.55.0
Attachment:
signature.asc
Description: PGP signature