tree: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next head: 5e948d5cefebebe2315faf356d7b5180144b17b0 commit: 43039cdd1a14ed12c7b506a2d78c7fa708444b06 efivarfs: add variable resync after hibernation date: 11 hours ago config: x86_64-buildonly-randconfig-002-20250109 (https://download.01.org/0day-ci/archive/20250110/202501100429.RSwlJMm0-lkp@xxxxxxxxx/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250110/202501100429.RSwlJMm0-lkp@xxxxxxxxx/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202501100429.RSwlJMm0-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): >> fs/efivarfs/vars.c:375: warning: Function parameter or struct member 'duplicate_check' not described in 'efivar_init' vim +375 fs/efivarfs/vars.c 2d82e6227ea189 Ard Biesheuvel 2022-06-20 362 2d82e6227ea189 Ard Biesheuvel 2022-06-20 363 /** 2d82e6227ea189 Ard Biesheuvel 2022-06-20 364 * efivar_init - build the initial list of EFI variables 2d82e6227ea189 Ard Biesheuvel 2022-06-20 365 * @func: callback function to invoke for every variable 2d82e6227ea189 Ard Biesheuvel 2022-06-20 366 * @data: function-specific data to pass to @func 2d82e6227ea189 Ard Biesheuvel 2022-06-20 367 * 2d82e6227ea189 Ard Biesheuvel 2022-06-20 368 * Get every EFI variable from the firmware and invoke @func. @func b538f1e229e58c James Bottomley 2025-01-06 369 * should populate the initial dentry and inode tree. 2d82e6227ea189 Ard Biesheuvel 2022-06-20 370 * 2d82e6227ea189 Ard Biesheuvel 2022-06-20 371 * Returns 0 on success, or a kernel error code on failure. 2d82e6227ea189 Ard Biesheuvel 2022-06-20 372 */ b538f1e229e58c James Bottomley 2025-01-06 373 int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), 43039cdd1a14ed James Bottomley 2025-01-07 374 void *data, bool duplicate_check) 2d82e6227ea189 Ard Biesheuvel 2022-06-20 @375 { f45812cc23fb74 Tim Schumacher 2024-01-26 376 unsigned long variable_name_size = 512; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 377 efi_char16_t *variable_name; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 378 efi_status_t status; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 379 efi_guid_t vendor_guid; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 380 int err = 0; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 381 2d82e6227ea189 Ard Biesheuvel 2022-06-20 382 variable_name = kzalloc(variable_name_size, GFP_KERNEL); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 383 if (!variable_name) { 2d82e6227ea189 Ard Biesheuvel 2022-06-20 384 printk(KERN_ERR "efivars: Memory allocation failed.\n"); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 385 return -ENOMEM; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 386 } 2d82e6227ea189 Ard Biesheuvel 2022-06-20 387 2d82e6227ea189 Ard Biesheuvel 2022-06-20 388 err = efivar_lock(); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 389 if (err) 2d82e6227ea189 Ard Biesheuvel 2022-06-20 390 goto free; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 391 2d82e6227ea189 Ard Biesheuvel 2022-06-20 392 /* f45812cc23fb74 Tim Schumacher 2024-01-26 393 * A small set of old UEFI implementations reject sizes f45812cc23fb74 Tim Schumacher 2024-01-26 394 * above a certain threshold, the lowest seen in the wild f45812cc23fb74 Tim Schumacher 2024-01-26 395 * is 512. 2d82e6227ea189 Ard Biesheuvel 2022-06-20 396 */ 2d82e6227ea189 Ard Biesheuvel 2022-06-20 397 2d82e6227ea189 Ard Biesheuvel 2022-06-20 398 do { f45812cc23fb74 Tim Schumacher 2024-01-26 399 variable_name_size = 512; cda30c6542c8bb Tim Schumacher 2024-03-28 400 BUILD_BUG_ON(EFI_VAR_NAME_LEN < 512); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 401 2d82e6227ea189 Ard Biesheuvel 2022-06-20 402 status = efivar_get_next_variable(&variable_name_size, 2d82e6227ea189 Ard Biesheuvel 2022-06-20 403 variable_name, 2d82e6227ea189 Ard Biesheuvel 2022-06-20 404 &vendor_guid); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 405 switch (status) { 2d82e6227ea189 Ard Biesheuvel 2022-06-20 406 case EFI_SUCCESS: 2d82e6227ea189 Ard Biesheuvel 2022-06-20 407 variable_name_size = var_name_strnsize(variable_name, 2d82e6227ea189 Ard Biesheuvel 2022-06-20 408 variable_name_size); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 409 2d82e6227ea189 Ard Biesheuvel 2022-06-20 410 /* 2d82e6227ea189 Ard Biesheuvel 2022-06-20 411 * Some firmware implementations return the 2d82e6227ea189 Ard Biesheuvel 2022-06-20 412 * same variable name on multiple calls to 2d82e6227ea189 Ard Biesheuvel 2022-06-20 413 * get_next_variable(). Terminate the loop 2d82e6227ea189 Ard Biesheuvel 2022-06-20 414 * immediately as there is no guarantee that 2d82e6227ea189 Ard Biesheuvel 2022-06-20 415 * we'll ever see a different variable name, 2d82e6227ea189 Ard Biesheuvel 2022-06-20 416 * and may end up looping here forever. 2d82e6227ea189 Ard Biesheuvel 2022-06-20 417 */ 43039cdd1a14ed James Bottomley 2025-01-07 418 if (duplicate_check && 43039cdd1a14ed James Bottomley 2025-01-07 419 efivarfs_variable_is_present(variable_name, 4ec7bd5db9a1f6 James Bottomley 2025-01-06 420 &vendor_guid, data)) { 2d82e6227ea189 Ard Biesheuvel 2022-06-20 421 dup_variable_bug(variable_name, &vendor_guid, 2d82e6227ea189 Ard Biesheuvel 2022-06-20 422 variable_name_size); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 423 status = EFI_NOT_FOUND; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 424 } else { 2d82e6227ea189 Ard Biesheuvel 2022-06-20 425 err = func(variable_name, vendor_guid, b538f1e229e58c James Bottomley 2025-01-06 426 variable_name_size, data); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 427 if (err) 2d82e6227ea189 Ard Biesheuvel 2022-06-20 428 status = EFI_NOT_FOUND; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 429 } 2d82e6227ea189 Ard Biesheuvel 2022-06-20 430 break; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 431 case EFI_UNSUPPORTED: 2d82e6227ea189 Ard Biesheuvel 2022-06-20 432 err = -EOPNOTSUPP; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 433 status = EFI_NOT_FOUND; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 434 break; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 435 case EFI_NOT_FOUND: 2d82e6227ea189 Ard Biesheuvel 2022-06-20 436 break; f45812cc23fb74 Tim Schumacher 2024-01-26 437 case EFI_BUFFER_TOO_SMALL: f45812cc23fb74 Tim Schumacher 2024-01-26 438 pr_warn("efivars: Variable name size exceeds maximum (%lu > 512)\n", f45812cc23fb74 Tim Schumacher 2024-01-26 439 variable_name_size); f45812cc23fb74 Tim Schumacher 2024-01-26 440 status = EFI_NOT_FOUND; f45812cc23fb74 Tim Schumacher 2024-01-26 441 break; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 442 default: f45812cc23fb74 Tim Schumacher 2024-01-26 443 pr_warn("efivars: get_next_variable: status=%lx\n", status); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 444 status = EFI_NOT_FOUND; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 445 break; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 446 } 2d82e6227ea189 Ard Biesheuvel 2022-06-20 447 2d82e6227ea189 Ard Biesheuvel 2022-06-20 448 } while (status != EFI_NOT_FOUND); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 449 2d82e6227ea189 Ard Biesheuvel 2022-06-20 450 efivar_unlock(); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 451 free: 2d82e6227ea189 Ard Biesheuvel 2022-06-20 452 kfree(variable_name); 2d82e6227ea189 Ard Biesheuvel 2022-06-20 453 2d82e6227ea189 Ard Biesheuvel 2022-06-20 454 return err; 2d82e6227ea189 Ard Biesheuvel 2022-06-20 455 } 2d82e6227ea189 Ard Biesheuvel 2022-06-20 456 :::::: The code at line 375 was first introduced by commit :::::: 2d82e6227ea189c0589e7383a36616ac2a2d248c efi: vars: Move efivar caching layer into efivarfs :::::: TO: Ard Biesheuvel <ardb@xxxxxxxxxx> :::::: CC: Ard Biesheuvel <ardb@xxxxxxxxxx> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki