Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: "Atte Heikkilä" <atteh.mailbox@gmail.com>
To: linkinjeon@kernel.org
Cc: atteh.mailbox@gmail.com, linux-cifs@vger.kernel.org
Subject: Re: [PATCH 1/2] ksmbd: casefold utf-8 share names and fix ascii
Date: Mon, 12 Sep 2022 19:14:59 +0300	[thread overview]
Message-ID: <20220912161459.23505-1-atteh.mailbox@gmail.com> (raw)
In-Reply-To: <CAKYAXd_ondWwEuHhVZnVp0dd6N5ZZzw=2EJXSicEYSjwdBB46A@mail.gmail.com>

On Mon, 12 Sep 2022 19:20:54 +0900, Namjae Jeon wrote:
>2022-09-12 5:57 GMT+09:00, Atte Heikkilä <atteh.mailbox@gmail.com>:
>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) {

This mailing list already has a v2 patch series. Please, reply to that one.
As for your suggestion, I thought to keep the statements separate since the
block with the IS_ENABLED() macro is optimized away when CONFIG_UNICODE is
not set. I understand that the behavior is the same with your suggestion.

Thank you.

>
>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;
>> +}
>> +

  reply	other threads:[~2022-09-12 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11 20:57 [PATCH 1/2] ksmbd: casefold utf-8 share names and fix ascii lowercase conversion Atte Heikkilä
2022-09-11 20:57 ` [PATCH 2/2] ksmbd-tools: casefold utf-8 share names Atte Heikkilä
2022-09-12 10:20 ` [PATCH 1/2] ksmbd: casefold utf-8 share names and fix ascii lowercase conversion Namjae Jeon
2022-09-12 16:14   ` Atte Heikkilä [this message]
2022-09-13 14:04     ` [PATCH 1/2] ksmbd: casefold utf-8 share names and fix ascii Namjae Jeon
2022-09-13 17:44       ` [PATCH 1/2] ksmbd: casefold utf-8 share names and fix ascii lowercase conversion Atte Heikkilä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220912161459.23505-1-atteh.mailbox@gmail.com \
    --to=atteh.mailbox@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox