Hi Bartosz, > Date: 2026-11-25 17:10:35+0100 > From: Bartosz Golaszewski > > On Sat, Nov 14, 2026 at 04:22:16PM +0100, Alejandro Colomar wrote: > > str_has_prefix() returns the prefix length on match and 0 on mismatch, > > so the mistmatch case can't be told from "empty prefix matched an empty > > string". > > > > For instance: the OF root node's name as returned by > > fwnode_get_name() is "" and will return 0 for any name matched against > > it and since len is 0 too, fwnode_name_eq() will return true. > > > > Let's use strprefix() instead, which also makes this function simpler. > > > > Fixes: a9c8c738066b7 ("device property: Add fwnode_name_eq()") > > Closes: https://lore.kernel.org/linux-hardening/20261104-fwnode-for-each-prop-v1-1-6e28fe1c72c4@oss.qualcomm.com/ > > Reported-by: Bartosz Golaszewski > > Signed-off-by: Alejandro Colomar > > --- > > Reviewed-by: Bartosz Golaszewski > Tested-by: Bartosz Golaszewski > > This series has grown substantially since v1. My GPIO series[1] depends on > fwnode_name_eq() working correctly so I would really appreciate it if we > could queue the bits and pieces fixing fwnode_name_eq() separately and sooner > rather than later (it should also be backported to stable). I agree. The const-preserving macro can be left for later. And the global replacements can also be left for later (Andy asked to see them, but didn't require that we have them in the same patch set, so we can now remove them from this patch set). And strsuffix() is only for symmetry, but can also be left for later. Same with streq(3). I'll send a small revised patch set that is minimal for this fix. Thanks! Have a lovely day! Alex > > Thanks > Bartosz > > [1] https://lore.kernel.org/all/20261120-fwnode-for-each-prop-v3-0-808e304dc73e@oss.qualcomm.com/ > --