[bug report] ACPI: Drop parent field from struct acpi_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Rafael J. Wysocki,

This is a semi-automatic email about new static checker warnings.

The patch 62fcb99bdf10: "ACPI: Drop parent field from struct
acpi_device" from Aug 24, 2022, leads to the following Smatch
complaint:

    drivers/acpi/device_pm.c:166 acpi_device_set_power()
    warn: variable dereferenced before check 'device' (see line 162)

drivers/acpi/device_pm.c
   161	{
   162		struct acpi_device *parent = acpi_dev_parent(device);
                                                             ^^^^^^
Dereverence

   163		int target_state = state;
   164		int result = 0;
   165	
   166		if (!device || !device->flags.power_manageable
                    ^^^^^^^
Checked too late.

   167		    || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
   168			return -EINVAL;

regards,
dan carpenter



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux