mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
media: atomisp: avoid ACPI package count underflow in gmin_cfg_get_dsm
gmin_cfg_get_dsm() iterates over ACPI _DSM package elements as key/value pairs using obj->package.count - 1 as the loop bound. If package.count is 0, the subtraction underflows and may lead to out-of-bounds access. Use i + 1 < obj->package.count instead. Signed-off-by: Mohamad El Harake <mohamedharake2006@gmail.com> Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
parent
7d0e5f2ee1
commit
7488f3e073
|
|
@ -113,7 +113,7 @@ static char *gmin_cfg_get_dsm(struct acpi_device *adev, const char *key)
|
|||
if (!obj)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < obj->package.count - 1; i += 2) {
|
||||
for (i = 0; i + 1 < obj->package.count; i += 2) {
|
||||
key_el = &obj->package.elements[i + 0];
|
||||
val_el = &obj->package.elements[i + 1];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user