WSL2-Linux-Kernel/drivers/acpi
Christophe JAILLET 6b413d52f6 ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()
[ Upstream commit 48cf49d31994ff97b33c4044e618560ec84d35fb ]

snprintf() does not return negative values on error.

To know if the buffer was too small, the returned value needs to be
compared with the length of the passed buffer. If it is greater or
equal, the output has been truncated, so add checks for the truncation
to create_pnp_modalias() and create_of_modalias(). Also make them
return -ENOMEM in that case, as they already do that elsewhere.

Moreover, the remaining size of the buffer used by snprintf() needs to
be updated after the first write to avoid out-of-bounds access as
already done correctly in create_pnp_modalias(), but not in
create_of_modalias(), so change the latter accordingly.

Fixes: 8765c5ba19 ("ACPI / scan: Rework modalias creation when "compatible" is present")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
[ rjw: Merge two patches into one, combine changelogs, add subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:08:16 +01:00
..
acpica ACPICA: Add AML_NO_OPERAND_RESOLVE flag to Timer 2023-09-23 11:09:55 +02:00
apei ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init() 2022-11-10 18:15:34 +01:00
arm64 perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09 2023-09-23 11:09:55 +02:00
dptf
nfit ACPI: NFIT: fix a potential deadlock during NFIT teardown 2023-03-03 11:45:52 +01:00
numa ACPI: HMAT: Fix initiator registration for single-initiator systems 2022-12-08 11:28:45 +01:00
pmic ACPI: PMIC: Fix intel_pmic_regs_handler() read accesses 2021-11-18 19:17:06 +01:00
x86 ACPI: x86: s2idle: Catch multiple ACPI_TYPE_PACKAGE objects 2023-09-23 11:09:55 +02:00
Kconfig
Makefile
ac.c ACPI: AC: Quirk GK45 to skip reading _PSR 2021-11-18 19:16:19 +01:00
acpi_adxl.c
acpi_amba.c
acpi_apd.c
acpi_cmos_rtc.c
acpi_configfs.c
acpi_dbg.c
acpi_extlog.c ACPI: extlog: Handle multiple records 2022-10-29 10:12:55 +02:00
acpi_fpdt.c ACPI: tables: FPDT: Don't call acpi_os_map_memory() on invalid phys address 2022-10-26 12:35:30 +02:00
acpi_ipmi.c
acpi_lpat.c
acpi_lpit.c
acpi_lpss.c ACPI: LPSS: Fix missing check in register_device_clock() 2022-08-17 14:23:03 +02:00
acpi_memhotplug.c
acpi_pad.c
acpi_platform.c
acpi_pnp.c
acpi_processor.c
acpi_tad.c
acpi_video.c ACPI: video: Add Toshiba Satellite/Portege Z830 quirk 2022-10-26 12:35:30 +02:00
acpi_watchdog.c
battery.c ACPI: battery: Fix missing NUL-termination with large strings 2023-03-10 09:39:11 +01:00
bgrt.c
blacklist.c
bus.c ACPI: VIOT: Fix ACS setup 2022-08-17 14:23:11 +02:00
button.c
container.c
cppc_acpi.c ACPI: CPPC: Do not prevent CPPC from working in the future 2022-08-17 14:24:25 +02:00
custom_method.c
debugfs.c
device_pm.c
device_sysfs.c ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias() 2023-11-20 11:08:16 +01:00
dock.c
ec.c ACPI: EC: Fix oops when removing custom query handlers 2023-05-24 17:36:44 +01:00
ec_sys.c
event.c
evged.c
fan.c
fan.h
glue.c Revert "ACPI: scan: Release PM resources blocked by unused objects" 2021-11-21 13:44:14 +01:00
hed.c
internal.h ACPI: EC: Rework flushing of EC work while suspended to idle 2022-01-27 11:03:23 +01:00
ioapic.c
irq.c ACPI: irq: Fix incorrect return value in acpi_register_gsi() 2023-10-25 11:59:02 +02:00
nvs.c
osi.c
osl.c Revert "ACPI: Add memory semantics to acpi_os_map_memory()" 2021-09-23 20:39:36 +02:00
pci_irq.c
pci_link.c
pci_mcfg.c PCI/ACPI: Guard ARM64-specific mcfg_quirks 2022-08-25 11:40:36 +02:00
pci_root.c ACPI: APEI: explicit init of HEST and GHES in apci_init() 2022-08-17 14:23:11 +02:00
pci_slot.c
platform_profile.c
power.c ACPI: PM: Fix device wakeup power reference counting error 2021-11-18 19:17:09 +01:00
pptt.c
prmt.c ACPI: PRM: Check whether EFI runtime is available 2023-01-24 07:22:45 +01:00
proc.c
processor_core.c
processor_driver.c
processor_idle.c ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel systems 2023-02-06 07:59:01 +01:00
processor_pdc.c ACPI: processor: Fix evaluating _PDC method when running as Xen dom0 2023-05-11 23:00:22 +09:00
processor_perflib.c ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily 2023-08-03 10:22:46 +02:00
processor_thermal.c ACPI: processor: Remove freq Qos request for all CPUs 2022-08-31 17:16:48 +02:00
processor_throttling.c
property.c ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool 2022-08-25 11:40:10 +02:00
reboot.c
resource.c ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CBA 2023-10-19 23:05:36 +02:00
sbs.c
sbshc.c
sbshc.h
scan.c ACPI: scan: Add LATT2021 to acpi_ignore_dep_ids[] 2022-11-26 09:24:31 +01:00
sleep.c ACPI: sleep: Avoid breaking S3 wakeup due to might_sleep() 2023-06-28 10:29:42 +02:00
sleep.h
spcr.c
sysfs.c ACPI: sysfs: Fix BERT error region memory mapping 2022-05-30 09:28:58 +02:00
tables.c memblock: exclude MEMBLOCK_NOMAP regions from kmemleak 2021-10-21 18:30:49 -10:00
thermal.c ACPI: thermal: Drop nocrt parameter 2023-09-02 09:17:07 +02:00
tiny-power-button.c
utils.c
video_detect.c ACPI: video: Add backlight=native DMI quirk for Lenovo Ideapad Z470 2023-09-23 11:09:55 +02:00
viot.c ACPI: VIOT: Initialize the correct IOMMU fwspec 2023-05-11 23:00:23 +09:00
wakeup.c