diff options
Diffstat (limited to 'drivers/firmware/efi/vars.c')
-rw-r--r-- | drivers/firmware/efi/vars.c | 30 |
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); | |||
42 | EXPORT_SYMBOL_GPL(efivar_work); | 42 | EXPORT_SYMBOL_GPL(efivar_work); |
43 | 43 | ||
44 | static bool | 44 | static bool |
45 | validate_device_path(struct efi_variable *var, int match, u8 *buffer, | 45 | validate_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 | ||
77 | static bool | 77 | static bool |
78 | validate_boot_order(struct efi_variable *var, int match, u8 *buffer, | 78 | validate_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 | ||
88 | static bool | 88 | static bool |
89 | validate_load_option(struct efi_variable *var, int match, u8 *buffer, | 89 | validate_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 | ||
139 | static bool | 139 | static bool |
140 | validate_uint16(struct efi_variable *var, int match, u8 *buffer, | 140 | validate_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 | ||
150 | static bool | 150 | static bool |
151 | validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, | 151 | validate_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 | ||
167 | struct variable_validate { | 167 | struct 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 | ||
191 | bool | 191 | bool |
192 | efivar_validate(struct efi_variable *var, u8 *data, unsigned long len) | 192 | efivar_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 | /* |