Re: [PATCH 1/2] staging: exfat: clean up d_entry rebuilding.

From: Valdis KlÄtnieks
Date: Mon Mar 02 2020 - 05:30:05 EST


On Mon, 02 Mar 2020 18:57:15 +0900, Tetsuhiro Kohada said:
> Clean up d_entry rebuilding in exfat_rename_file() and move_file().
>
> -Replace memcpy of d_entry with structure copy.

Those look OK.

> -Change to use the value already stored in fid.

> - if (exfat_get_entry_type(epnew) == TYPE_FILE) {

> + if (fid->type == TYPE_FILE) {

Are you sure this is OK to do? exfat_get_entry_type() does a lot of
mapping between values, using a file_dentry_t->type, while
fid->type is a file_id_t->type. and at first read it's not obvious to me whether
fid->type is guaranteed to have the correct value already.

(The abundant use of 0xNN constants in exfat_get_entry_type() doesn't
inspire confidence that it's looking at what you think it's looking at...)


Attachment: pgpoqsQ3prVUW.pgp
Description: PGP signature