Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tetsuhiro Kohada <kohada.t2@gmail.com>
To: Namjae Jeon <namjae.jeon@samsung.com>
Cc: kohada.tetsuhiro@dc.mitsubishielectric.co.jp,
	mori.takahiro@ab.mitsubishielectric.co.jp,
	motai.hirotaka@aj.mitsubishielectric.co.jp,
	'Sungjong Seo' <sj1557.seo@samsung.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/5] exfat: integrates dir-entry getting and validation
Date: Thu, 27 Aug 2020 21:26:21 +0900	[thread overview]
Message-ID: <2d26da8b-eb50-1374-5cfc-c8ee1daabc0c@gmail.com> (raw)
In-Reply-To: <011101d67c20$e3d604e0$ab820ea0$@samsung.com>

Thank you for your quick review.

On 2020/08/27 12:19, Namjae Jeon wrote:
>> +	i = ES_INDEX_NAME;
>> +	while ((ep = exfat_get_validated_dentry(es, i++, TYPE_NAME))) {
> Please find the way to access name entries like ep_file, ep_stream
> without calling exfat_get_validated_dentry().

Hmm, it's a hard order.
I can't separate length/type validation and extraction.
Sorry, I have no good idea.


>> @@ -590,17 +587,16 @@ int exfat_remove_entries(struct inode *inode, struct exfat_chain *p_dir,  void
>> exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es)  {
>>   	int chksum_type = CS_DIR_ENTRY, i;
>> -	unsigned short chksum = 0;
>> +	u16 chksum = 0;
>>   	struct exfat_dentry *ep;
>>
>>   	for (i = 0; i < es->num_entries; i++) {
>> -		ep = exfat_get_dentry_cached(es, i);
>> +		ep = exfat_get_validated_dentry(es, i, TYPE_ALL);
> Ditto, You do not need to repeatedly call exfat_get_validated_dentry() for the entries
> which got from exfat_get_dentry_set().

Even if I could do that, it would be very difficult to implement a checksum patch.
It is also difficult to use for rename, move, delete.
(these also have no verification of neme-length and set-checksum)


>>   	/* validiate cached dentries */
>> -	for (i = 1; i < num_entries; i++) {
>> -		ep = exfat_get_dentry_cached(es, i);
>> -		if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode))
>> -			goto free_es;
>> +	es->ep_stream = exfat_get_validated_dentry(es, ES_INDEX_STREAM, TYPE_STREAM);
>> +	if (!es->ep_stream)
>> +		goto free_es;
>> +
>> +	if (max_entries == ES_ALL_ENTRIES) {
>> +		for (i = 0; i < ES_FILE(es).num_ext; i++)
>> +			if (!exfat_get_validated_dentry(es, ES_INDEX_STREAM + i, TYPE_SECONDARY))
>> +				goto free_es;
>> +		for (i = 0; i * EXFAT_FILE_NAME_LEN < ES_STREAM(es).name_len; i++)
>> +			if (!exfat_get_validated_dentry(es, ES_INDEX_NAME + i, TYPE_NAME))
>> +				goto free_es;
> Why do you unnecessarily check entries with two loops?
> Please refer to the patch I sent.

This order is possible.
However, TYPE_SECONDARY loop will be back as checksum loop.

In the next patch, I can fix the 'TYPE_SECONDARY loop' order.
do you need it?


BR
---
Tetsuhiro Kohada <kohada.t2@gmail.com>



      reply	other threads:[~2020-08-27 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200826115753epcas1p3321f1021e92cfba8279d8976e835d436@epcas1p3.samsung.com>
2020-08-26 11:57 ` Tetsuhiro Kohada
2020-08-26 11:57   ` [PATCH v4 2/5] exfat: add NameLength check when extracting name Tetsuhiro Kohada
2020-08-26 11:57   ` [PATCH v4 3/5] exfat: unify name extraction Tetsuhiro Kohada
2020-08-26 11:57   ` [PATCH v4 4/5] exfat: add dir-entry set checksum validation Tetsuhiro Kohada
2020-08-26 11:57   ` [PATCH v4 5/5] exfat: write only modified part of dir-entry set Tetsuhiro Kohada
2020-08-27  3:19   ` [PATCH v4 1/5] exfat: integrates dir-entry getting and validation Namjae Jeon
2020-08-27 12:26     ` Tetsuhiro Kohada [this message]

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=2d26da8b-eb50-1374-5cfc-c8ee1daabc0c@gmail.com \
    --to=kohada.t2@gmail.com \
    --cc=kohada.tetsuhiro@dc.mitsubishielectric.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mori.takahiro@ab.mitsubishielectric.co.jp \
    --cc=motai.hirotaka@aj.mitsubishielectric.co.jp \
    --cc=namjae.jeon@samsung.com \
    --cc=sj1557.seo@samsung.com \
    --subject='Re: [PATCH v4 1/5] exfat: integrates dir-entry getting and validation' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).