2022-09-12 5:57 GMT+09:00, Atte Heikkilä <atteh.mailbox@xxxxxxxxx>: Hi Atte, [snip] > +static char *casefold_sharename(struct unicode_map *um, const char *name) > +{ > + char *cf_name; > + int cf_len; > + > + cf_name = kzalloc(KSMBD_REQ_MAX_SHARE_NAME, GFP_KERNEL); > + if (!cf_name) > + return ERR_PTR(-ENOMEM); > + > + if (IS_ENABLED(CONFIG_UNICODE)) { > + const struct qstr q_name = {.name = name, .len = strlen(name)}; > + > + if (!um) > + goto out_ascii; Minor nit, Wouldn't it be simpler to change something like the one below? + if (IS_ENABLED(CONFIG_UNICODE) && um) { Thanks! > + > + cf_len = utf8_casefold(um, &q_name, cf_name, > + KSMBD_REQ_MAX_SHARE_NAME); > + if (cf_len < 0) > + goto out_ascii; > + > + return cf_name; > + } > + > +out_ascii: > + cf_len = strscpy(cf_name, name, KSMBD_REQ_MAX_SHARE_NAME); > + if (cf_len < 0) > + return ERR_PTR(-E2BIG); > + > + for (; *cf_name; ++cf_name) > + *cf_name = isascii(*cf_name) ? tolower(*cf_name) : *cf_name; > + return cf_name - cf_len; > +} > +