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...@gmail.com>