if (data_size > 0) {
                status = check_var_size(nonblocking, attr,
-                                       data_size + ucs2_strsize(name, 1024));
+                                       data_size + ucs2_strsize(name, EFI_VAR_NAME_LEN));
                if (status != EFI_SUCCESS)
                        return status;
        }
 
        unsigned long strsize1, strsize2;
        bool found = false;
 
-       strsize1 = ucs2_strsize(variable_name, 1024);
+       strsize1 = ucs2_strsize(variable_name, EFI_VAR_NAME_LEN);
        list_for_each_entry_safe(entry, n, head, list) {
-               strsize2 = ucs2_strsize(entry->var.VariableName, 1024);
+               strsize2 = ucs2_strsize(entry->var.VariableName, EFI_VAR_NAME_LEN);
                if (strsize1 == strsize2 &&
                        !memcmp(variable_name, &(entry->var.VariableName),
                                strsize2) &&
 
        do {
                variable_name_size = 512;
+               BUILD_BUG_ON(EFI_VAR_NAME_LEN < 512);
 
                status = efivar_get_next_variable(&variable_name_size,
                                                  variable_name,
 
 #endif
 
 /*
- * The maximum size of VariableName + Data = 1024
- * Therefore, it's reasonable to save that much
- * space in each part of the structure,
- * and we use a page for reading/writing.
+ * There is no actual upper limit specified for the variable name size.
+ *
+ * This limit exists only for practical purposes, since name conversions
+ * are bounds-checked and name data is occasionally stored in-line.
  */
-
 #define EFI_VAR_NAME_LEN       1024
 
 int efivars_register(struct efivars *efivars,