Showing error 1646

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/pci/hotplug/acpiphp_ibm.c
Line in file: 231
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 07:54:05 UTC


Source:

201
202        stat = acpi_evaluate_integer(ibm_acpi_handle, "APLS", &params, &rc);
203        if (ACPI_FAILURE(stat)) {
204                err("APLS evaluation failed:  0x%08x\n", stat);
205                return -ENODEV;
206        } else if (!rc) {
207                err("APLS method failed:  0x%08llx\n", rc);
208                return -ERANGE;
209        }
210        return 0;
211}
212
213/**
214 * ibm_get_attention_status - callback method to get attention LED status
215 * @slot: the hotplug_slot to work with
216 * @status: returns what the LED is set to (0 or 1)
217 *
218 * Description: This method is registered with the acpiphp module as a
219 * callback to do the device specific task of getting the LED status.
220 * 
221 * Because there is no direct method of getting the LED status directly
222 * from an ACPI call, we read the aPCI table and parse out our
223 * slot descriptor to read the status from that.
224 */
225static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
226{
227        union apci_descriptor *ibm_slot;
228
229        ibm_slot = ibm_slot_from_id(hpslot_to_sun(slot));
230
231        if (ibm_slot->slot.attn & 0xa0 || ibm_slot->slot.status[1] & 0x08)
232                *status = 1;
233        else
234                *status = 0;
235
236        dbg("%s: get slot %d (%d) attention status is %d\n", __func__,
237                        ibm_slot->slot.slot_num, ibm_slot->slot.slot_id,
238                        *status);
239
240        kfree(ibm_slot);
241        return 0;
Show full sources