aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efi/vars.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firmware/efi/vars.c')
-rw-r--r--drivers/firmware/efi/vars.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index b22659cccca4..f0a43646a2f3 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -42,7 +42,7 @@ DECLARE_WORK(efivar_work, NULL);
42EXPORT_SYMBOL_GPL(efivar_work); 42EXPORT_SYMBOL_GPL(efivar_work);
43 43
44static bool 44static bool
45validate_device_path(struct efi_variable *var, int match, u8 *buffer, 45validate_device_path(efi_char16_t *var_name, int match, u8 *buffer,
46 unsigned long len) 46 unsigned long len)
47{ 47{
48 struct efi_generic_dev_path *node; 48 struct efi_generic_dev_path *node;
@@ -75,7 +75,7 @@ validate_device_path(struct efi_variable *var, int match, u8 *buffer,
75} 75}
76 76
77static bool 77static bool
78validate_boot_order(struct efi_variable *var, int match, u8 *buffer, 78validate_boot_order(efi_char16_t *var_name, int match, u8 *buffer,
79 unsigned long len) 79 unsigned long len)
80{ 80{
81 /* An array of 16-bit integers */ 81 /* An array of 16-bit integers */
@@ -86,18 +86,18 @@ validate_boot_order(struct efi_variable *var, int match, u8 *buffer,
86} 86}
87 87
88static bool 88static bool
89validate_load_option(struct efi_variable *var, int match, u8 *buffer, 89validate_load_option(efi_char16_t *var_name, int match, u8 *buffer,
90 unsigned long len) 90 unsigned long len)
91{ 91{
92 u16 filepathlength; 92 u16 filepathlength;
93 int i, desclength = 0, namelen; 93 int i, desclength = 0, namelen;
94 94
95 namelen = ucs2_strnlen(var->VariableName, sizeof(var->VariableName)); 95 namelen = ucs2_strnlen(var_name, EFI_VAR_NAME_LEN);
96 96
97 /* Either "Boot" or "Driver" followed by four digits of hex */ 97 /* Either "Boot" or "Driver" followed by four digits of hex */
98 for (i = match; i < match+4; i++) { 98 for (i = match; i < match+4; i++) {
99 if (var->VariableName[i] > 127 || 99 if (var_name[i] > 127 ||
100 hex_to_bin(var->VariableName[i] & 0xff) < 0) 100 hex_to_bin(var_name[i] & 0xff) < 0)
101 return true; 101 return true;
102 } 102 }
103 103
@@ -132,12 +132,12 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer,
132 /* 132 /*
133 * And, finally, check the filepath 133 * And, finally, check the filepath
134 */ 134 */
135 return validate_device_path(var, match, buffer + desclength + 6, 135 return validate_device_path(var_name, match, buffer + desclength + 6,
136 filepathlength); 136 filepathlength);
137} 137}
138 138
139static bool 139static bool
140validate_uint16(struct efi_variable *var, int match, u8 *buffer, 140validate_uint16(efi_char16_t *var_name, int match, u8 *buffer,
141 unsigned long len) 141 unsigned long len)
142{ 142{
143 /* A single 16-bit integer */ 143 /* A single 16-bit integer */
@@ -148,7 +148,7 @@ validate_uint16(struct efi_variable *var, int match, u8 *buffer,
148} 148}
149 149
150static bool 150static bool
151validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, 151validate_ascii_string(efi_char16_t *var_name, int match, u8 *buffer,
152 unsigned long len) 152 unsigned long len)
153{ 153{
154 int i; 154 int i;
@@ -166,7 +166,7 @@ validate_ascii_string(struct efi_variable *var, int match, u8 *buffer,
166 166
167struct variable_validate { 167struct variable_validate {
168 char *name; 168 char *name;
169 bool (*validate)(struct efi_variable *var, int match, u8 *data, 169 bool (*validate)(efi_char16_t *var_name, int match, u8 *data,
170 unsigned long len); 170 unsigned long len);
171}; 171};
172 172
@@ -189,10 +189,10 @@ static const struct variable_validate variable_validate[] = {
189}; 189};
190 190
191bool 191bool
192efivar_validate(struct efi_variable *var, u8 *data, unsigned long len) 192efivar_validate(efi_char16_t *var_name, u8 *data, unsigned long len)
193{ 193{
194 int i; 194 int i;
195 u16 *unicode_name = var->VariableName; 195 u16 *unicode_name = var_name;
196 196
197 for (i = 0; variable_validate[i].validate != NULL; i++) { 197 for (i = 0; variable_validate[i].validate != NULL; i++) {
198 const char *name = variable_validate[i].name; 198 const char *name = variable_validate[i].name;
@@ -208,7 +208,7 @@ efivar_validate(struct efi_variable *var, u8 *data, unsigned long len)
208 208
209 /* Wildcard in the matching name means we've matched */ 209 /* Wildcard in the matching name means we've matched */
210 if (c == '*') 210 if (c == '*')
211 return variable_validate[i].validate(var, 211 return variable_validate[i].validate(var_name,
212 match, data, len); 212 match, data, len);
213 213
214 /* Case sensitive match */ 214 /* Case sensitive match */
@@ -217,7 +217,7 @@ efivar_validate(struct efi_variable *var, u8 *data, unsigned long len)
217 217
218 /* Reached the end of the string while matching */ 218 /* Reached the end of the string while matching */
219 if (!c) 219 if (!c)
220 return variable_validate[i].validate(var, 220 return variable_validate[i].validate(var_name,
221 match, data, len); 221 match, data, len);
222 } 222 }
223 } 223 }
@@ -805,7 +805,7 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
805 805
806 *set = false; 806 *set = false;
807 807
808 if (efivar_validate(&entry->var, data, *size) == false) 808 if (efivar_validate(name, data, *size) == false)
809 return -EINVAL; 809 return -EINVAL;
810 810
811 /* 811 /*