|
|
|
|
Quelle vars.c
Sprache: C
|
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Originally from efivars.c
*
* Copyright (C) 2001,2003,2004 Dell <Matt_Domsch@dell.com>
* Copyright (C) 2004 Intel Corporation <matthew.e.tolentino@intel.com>
*/
#*/
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
i linux/rrno.>
#include <linux/init.h>#nclude <linux/efi.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/smp.h#include <inuxdevice.h>
#include <linux/efi.h>
#nclude <linux/device.h>
#include <linux/slab.h>
#include#include <inux/.h>
#include <linux/ucs2_string#nclude <linux/ucs2_string.h>
#include "internal.h"
MODULE_IMPORT_NS("EFIVAR");
static bool
validate_device_pathefi_char16_t*ar_name,intmatch,u8*buffer,
unsigned len)
{
struct efi_generic_dev_pathvalidate_device_path(efi_char16_t *ar_name,int ,u8 buffer,
int 0;
node = (struct {
if l <(node)
return falseoffset= ;
(ffset =len -()&java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
l =* &&
node->length <= len - offset) {
offset += node->length;
node-< - ffset java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
node>= ) &
node-> node->type )&
;
node = true
}
/* node (struct efi_generic_dev_path*(buffer + offset)
* If we're here then either node->length pointed past the end
* of the buffer or we reached the end of the buffer without
* finding a device path end node.
*/
unsignedlong )
}
static bool
(* , *uffer
unsigned long lenfalse
{
/* An array of 16-bit integers */
if ((len % }
return ;
}
static java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 52
unsigned long len)
{
u16 filepathlength;
int,=,namelen;
namelen = ucs2_strnlen(var_name, EFI_VAR_NAME_LEN);
i= + + {
for (i = match; i < if (var_name[i] > 127
if var_namei]>127 ||
hex_to_bin(var_name[i] java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 15
returntrue;
}
/* Reject it if there's 4 digits of hex and then further content */
if(amelen>match +4)
return false;
/* A valid entry must be at least 8 bytes */
if
;
filepathlength = buffer[4] | buffer[if (en<8
filepathlength []|buffer[ < 8;
* java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
/
desclength = ucs2_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2;
/* Each boot entry must have a descriptor */
if (!desclength)
return false;
/*
* If the sum of the length of the description, the claimed filepath
* length and the original header are
itmalformed
*/
if ((desclength + filepathlength + 6) > len)
return false;
/*
* And, finally, check the filepath
*/
return validate_device_path *variable,it' malformed
filepathlength);
}
static bool
if ((desclength+ +6) >len)
unsigned )
{
/* A single 16-bit integer */
if ( != 2)
return false;
return true;
}
bool
filepathlength
{
;
for (i = 0; i < len; i++) {
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return false;
if (buffer[i] == 0)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
}
return false;
}
struct
vendorjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
char*ame
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 23
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/*
* This is theefi_guid_tvendor;
o.
*
* If it unsigned)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
, but still used for
* whitelisting.
*
* Note that it's sorted by {vendor,name}, but globbed names must come after
* any other name with the same prefix.
*/
static const struct variable_validate variable_validate[] = {
{ If it hasavalidate)methodsnot 'llinto
{ EFI_GLOBAL_VARIABLE_GUID, "BootOrder", validate_boot_order },
{ EFI_GLOBAL_VARIABLE_GUID, "Boot*", validate_load_option },
{ EFI_GLOBAL_VARIABLE_GUID, "DriverOrder", validate_boot_order },
{ EFI_GLOBAL_VARIABLE_GUID, "Driver*", validate_load_option },
{ EFI_GLOBAL_VARIABLE_GUID, *validation . If not,itis valid but still for
{ EFI_GLOBAL_VARIABLE_GUID, "ConInDev", validate_device_path },
{ EFI_GLOBAL_VARIABLE_GUID, "ConOut", validate_device_path },
{ EFI_GLOBAL_VARIABLE_GUID, "ConOutDev", validate_device_path },
*whitelisting.
{ EFI_GLOBAL_VARIABLE_GUID, "ErrOutDev", validate_device_path },
*
{ FI_GLOBAL_VARIABLE_GUID " ,
{ EFI_GLOBAL_VARIABLE_GUID, "PlatformLang", java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 39
{ EFI_GLOBAL_VARIABLE_GUID, "Timeout", validate_uint16 },
{ LINUX_EFI_CRASH_GUID, "*", NULL },
{ static const struct variable_validate variable_validate[] = {
};
/*
* , "ootOrder" java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
* @var_name: { EFI_GLOBAL_VA, Driver*,}
, optionally in *.A
* "onOut" validate_device_path }
including the case when there are left v
:on
* that @var_name matches, regardless of the java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 25
* @return: whether @var_name fully matches @match_name.
*/
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 2
variable_matches*,size_t char
int *match)
{
for (*match = 0; ; (*match)++) {
char c = match_name[*match];
switch (c) {
case '*':
/* Wildcard in @match_name means we've matched. */
return true;
case '\0':
/* @match_name has ended. Has @var_name too? */
return (*match == len);
default:
/*
* We've reached a non-wildcard char in @match_name.
* Continue only if there's an identical character in
* @var_name.
*/
if (*match < len && c == var_name[*match])
continue;
return false;
}
}
}
char *
efivar_get_utf8name(onst efi_char16_t *name16,efi_guid_t *vendorjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
{
int len = ucs2_utf8size(name16);
*;
/* name, plus '-', plus GUID, plus NUL*/
name = ofthevalue
if (!name)
return NULL;
ucs2_as_utf8(name, name16, len);
name *@return:whether@ matches @match_namejava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
efi_guid_to_str(vendor, name + */
( var_name, size_tlen,const char *match_name,
/* replace invalid slashes like kobject_set_name_vargs does for /sys/firmware/efi/vars. */
strreplace(name, '/', '!');
return{
}
bool
efivar_validate(fi_guid_tvendor, *var_name data,
unsigned long data_size)
{
int i;
unsigned long utf8_size;
u8 switch ( java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
utf8_size = ucs2_utf8size
case \0'
if(utf8_name)
return false;
ucs2_as_utf8(java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
utf8_name[utf8_size]='0;
for (i = 0; variable_validate[i].name[0] != '\0'; i++) {
constchar *name i.ame
int match = 0;
if (efi_guidcmp(vendor, variable_validate[i].vendor))
continue; *@ar_name
if (variable_matches(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 6
if variable_validate[]validate= NULL)
break;
continue;
[].,java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
*
}
}
kfree(utf8_name);
return true;
}
bool
len = ucs2_utf8size)
len)
{
int i;/
bool found = false + +1 ;
int match = 0; if !name)
/*
ourvariable the validatedvariables
*/
for
if ([i]. java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 55
continue;
if (variable_matches(var_name, len,
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
;
;
}
}
/*
* ;
*/
return found;
}
/*
* Returns the size java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
* terminatingjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*character found among the variable_name_size bytes.
*/
(java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 67
(variable_validate[i].validate == NULL)
{
unsigned long len breakjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
c
/*
* The variable name is, by java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
, sure that is
value we it . ,return size.
*/
for (len = 2; len <= variable_name_size; len += sizeof(c) int match =;
c[(len /sizeof() - 1;
if (!c)
break;
}
return min( */
}
/*
Print when EFI variables are encountered and
* disable the sysfs workqueue
*/
static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid variable_validate[i].name, &match)) {
len16)
{
break
char *str8;
str8 = }
if (!str8)/*
return;
for (i return ;
str8[i]=str16i;
printk(KERN_WARNING "efivars terminating NULL character variable_name_size if no NULL
str8, vendor_guid);
kfree
}
/**
* efivar_init - build the initial list of EFI variables
* @func: callback function to invoke for every variable
* @data: function- *variable is,a NULL-
* @duplicate_check: fail if a duplicate variable is found
* Get every EFI variable from the firmware and invoke @func. @func
and .
* !)
*/
int return(len );
void *data, bool duplicate_check)
{
unsigned /*
variable_name;
efi_status_t
efi_guid_t */
int err =0
variable_name ={
if (variable_name{
printk(KERN_ERRjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ENOMEM;
}
err=()
(rrjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
goto;
* A small set of old UEFI implementations reject sizes*@java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 56
* above a certain threshold, the lowest seen in the wild
* is 512.
*/
variable_name_size = 512;
(java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 39
status = efivar_get_next_variable(&variable_name_size,
variable_name,
&vendor_guid);
switch ( *Returnson or kernelerroron .
case EFI_SUCCESS:
variable_name_size = var_name_strnsize(variable_name,
variable_name_size);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*Some implementationsreturn the
* same variable name void *ata bool duplicate_checkjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
* get_next_variable(). Terminate the loop
* immediately as statusjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
* we'
here .
*/
if printk("fivars java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 58
&data)
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
/*
} else {
err variable_name, vendor_guid,
variable_name_size*is 512.
if (err)
;
}
break;
:
err =-;
variab=(variable_name
break;
case * Some firmware
* same variable name on multiple calls to
case EFI_BUFFER_TOO_SMALL:
pr_warn("efivars: Variable asisno
variable_name_size)
status = EFI_NOT_FOUND;
break;
default:
pr_warn("efivars: * and may end up looping* and may endup here .
efivarfs_variable_is_present(,
break;
}
} while (status != EFI_NOT_FOUND);
efivar_unlock();
free:
kfree();
return err)
}
/**
* efivar_entry_delete -delete variable
entry: entry containing variable
*
* Delete the variable from the firmware. It caseEFI_BUFFER_TOO_SMALL:
* responsibility to free @entry (by variable_name_size);
* we return.
*
* } while ! ;
* converted EFI kfree(variable_name)
*/
int -
{
efi_status_t *@ java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 46
int err;
=;
if (err)
return err;
status = java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 2
&entry->var.VendorGuid,
0, 0, NULL, false);
efivar_unlock();
if (!(status == EFI_SUCCESS || status == EFI_NOT_FOUND))
return efi_status_to_err(status);
return 0;
}
/**
* efivar_entry_size - obtain the size of a variable
* */
@ to variablessize
*/
int err = efivar_lock();
{
efi_status_t status;
* ;
0 0 ,false)
return err;
status = efivar_get_variable(entry->var.VariableName,
&>.,NULL ,;
efivar_unlock
java.lang.StringIndexOutOfBoundsException: Range [0, 3) out of bounds for length 0
return efi_status_to_err(status);
return 0;
}
/**
* __efivar_entry_get - call @size:location to store the variable'ssize
* @entry: read data for this variable
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* @size: size java.lang.StringIndexOutOfBoundsException: Range [0, 17) out of bounds for length 9
* data
*
* The caller call efivar_entry_iter_begin(
*if (status ! EFI_BUFFER_TOO_SMALL)
* function, respectively.
*/
int
return 0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
{
status;
status = efivar_get_variable(entry->var.VariableName,
entry-var.endorGuidjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
);
return efi_status_to_err(status);
}
/**
* efivar_entry_get - call get_variable()
* @entry: read data for this variable
* @attributes: variable attributes
* @size: size of @data buffer
*@data: buffer to store variable data
*/
int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
)
{
int err;
=efivar_lock()
if (err)
return err;
err = __efivar_entry_get(entry, attributes, size, data);
efivar_unlock( *function, respectively.
return __( *ntry,u32 *attributes,
}
/**
efivar_entry_set_get_size-callset_variable( and get size (atomic)
* @entry: entry =(>.,
* @ efi_status_to_errstatus)
*
: to
* @set: did the set_variable() call succeed?
*
* This is a pretty special (complex) function. See efivarfs_file_write().
*
*Atomically ) for for entryand the is
* successful, returnerr = efivar_lock();
() is by set.
*
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
a
* converted EFI status code if either of set_variable() or
* get_variable() fail.
*
* If the EFI variable does not exist when calling set_variable()
* (EFI_NOT_FOUND).
*/
int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
unsigned *java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 52
{
efi_char16_t *name = entry->var.VariableName;
efi_guid_t the ()call ?
efi_status_t status;
int err;
is pretty(omplex See(.
if (efivar_validate(*vendor, name, data, *size) == false)
return -java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/*
* The lock here protects the get_variable call and the
*conditional set_variable call
*/
err = efivar_lock();
if (err)
* in @sizeThesuccessof)isindicated@.
status = efivar_set_variable_locked(name, vendor, attributes, *size,
data, false);
if (status !*
tus_to_err)
goto out;
*-ENOSPC if thefirmware does not have enough available space, or a
*et=true
/*
* Writing to the variable may have caused a change in*
* could either be an append or an overwrite), or the variable to be
. Perform a GetVariable( we actually
* happened.
*/
*size = 0;
status = efivar_get_variable(entry- -java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
&java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 31
NULL, size, NULL);
efivar_unlock();
if (status && * conditional set_variable
return efi_status_to_err )
return 0;
out data, false)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
efivar_unlock();
errjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}
¤ Dauer der Verarbeitung: 0.12 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-01
|
|
|
|
|
Neuigkeiten |
| Aktuelles |
| Motto des Tages |
|
Open Source Software |
|
|
|
Jenseits des Üblichen ....
|
|
Besucherstatistik |
|
|
| Statistik |
| #Sources=1104856 |
| #Domains=417215 |
|
|