Commit de08874b authored by Hyunchul Lee's avatar Hyunchul Lee Committed by Namjae Jeon
Browse files

ntfs: match ntfs_resident_attr_min_value_length with $AttrDef



Update ntfs_resident_attr_min_value_length() to align with $AttrDef.
The $VOLUME_NAME is allowed to have the  size of 0.

The Windows 11 $AttrDef values are as follows:

Attribute Name             (ID)   Size (Min-Max)  Flags

$STANDARD_INFORMATION      (16)   48-72           Resident
$ATTRIBUTE_LIST            (32)   No Limit        Non-resident
$FILE_NAME                 (48)   68-578          Resident, Index
$OBJECT_ID                 (64)   0-256           Resident
$SECURITY_DESCRIPTOR       (80)   No Limit        Non-resident
$VOLUME_NAME               (96)   2-256           Resident
$VOLUME_INFORMATION        (112)  12-12           Resident
$DATA                      (128)  No Limit        (None)
$INDEX_ROOT                (144)  No Limit        Resident
$INDEX_ALLOCATION          (160)  No Limit        Non-resident
$BITMAP                    (176)  No Limit        Non-resident
$REPARSE_POINT             (192)  0-16384         Non-resident
$EA_INFORMATION            (208)  8-8             Resident
$EA                        (224)  0-65536         (None)
$LOGGED_UTILITY_STREAM     (256)  0-65536         Non-resident

Reported-by: default avatarwoot000 <woot000@woot000.com>
Signed-off-by: default avatarHyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent 6c30af0b
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -583,24 +583,13 @@ static u32 ntfs_resident_attr_min_value_length(const __le32 type)
	case AT_STANDARD_INFORMATION:
		return offsetof(struct standard_information, ver) +
		       sizeof(((struct standard_information *)0)->ver.v1.reserved12);
	case AT_ATTRIBUTE_LIST:
		return offsetof(struct attr_list_entry, name);
	case AT_FILE_NAME:
		return offsetof(struct file_name_attr, file_name);
	case AT_OBJECT_ID:
		return sizeof(struct guid);
	case AT_SECURITY_DESCRIPTOR:
		return sizeof(struct security_descriptor_relative);
		return offsetof(struct file_name_attr, file_name) +
			sizeof(__le16) * 1;
	case AT_VOLUME_INFORMATION:
		return sizeof(struct volume_information);
	case AT_INDEX_ROOT:
		return sizeof(struct index_root);
	case AT_REPARSE_POINT:
		return offsetof(struct reparse_point, reparse_data);
	case AT_EA_INFORMATION:
		return sizeof(struct ea_information);
	case AT_EA:
		return offsetof(struct ea_attr, ea_name) + 1;
	default:
		return 0;
	}