Re: [PATCH v6 4/9] ovl: Create ovl_casefold() to support casefolded strncmp()

From: André Almeida
Date: Wed Aug 27 2025 - 16:46:13 EST


Em 26/08/2025 04:19, Amir Goldstein escreveu:

Andre,

Just noticed this is a bug, should have been if (*dst), but anyway following
Gabriel's comments I have made this change in my tree (pending more
strict related changes):

static int ovl_casefold(struct ovl_readdir_data *rdd, const char *str, int len,
char **dst)
{
const struct qstr qstr = { .name = str, .len = len };
char *cf_name;
int cf_len;

if (!IS_ENABLED(CONFIG_UNICODE) || !rdd->map || is_dot_dotdot(str, len))
return 0;

cf_name = kmalloc(NAME_MAX, GFP_KERNEL);
if (!cf_name) {
rdd->err = -ENOMEM;
return -ENOMEM;
}

cf_len = utf8_casefold(rdd->map, &qstr, *dst, NAME_MAX);

The third argument here should be cf_name, not *dst anymore.

if (cf_len > 0)
*dst = cf_name;
else
kfree(cf_name);

return cf_len;
}


Thanks,
Amir.