Skip to contentSkip to conversation

asus-wireless: Toggle airplane mode LED

bug report Dan Carpenter 2 participants 4 messages Feb 18, 2017 – Feb 21, 2017 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

Hello João Paulo Rechi Vita,

The patch 2c1a49c96123: "asus-wireless: Toggle airplane mode LED" from Jun 13, 2016, leads to the following static checker warning:

drivers/platform/x86/asus-wireless.c:54 asus_wireless_method()
error: uninitialized symbol 'ret'.

drivers/platform/x86/asus-wireless.c

    33  static u64 asus_wireless_method(acpi_handle handle, const char *method,
    34                                  int param)
    35  {
    36          struct acpi_object_list p;
    37          union acpi_object obj;
    38          acpi_status s;
    39          u64 ret;
    40  
    41          acpi_handle_debug(handle, "Evaluating method %s, parameter %#x\n",
    42                            method, param);
    43          obj.type = ACPI_TYPE_INTEGER;
    44          obj.integer.value = param;
    45          p.count = 1;
    46          p.pointer = &obj;
    47  
    48          s = acpi_evaluate_integer(handle, (acpi_string) method, &p, &ret);

"ret" isn't necessarily initialized on a couple error paths through this function.

    49          if (ACPI_FAILURE(s))
    50                  acpi_handle_err(handle,
    51                                  "Failed to eval method %s, param %#x (%d)\n",
    52                                  method, param, s);
    53          acpi_handle_debug(handle, "%s returned %#x\n", method, (uint) ret);
    54          return ret;
    55  }

regards,
dan carpenter

#1 lore raw
Quoted 26 lines · Dan Carpenter

Hello João Paulo Rechi Vita,

The patch 2c1a49c96123: "asus-wireless: Toggle airplane mode LED" from Jun 13, 2016, leads to the following static checker warning:

drivers/platform/x86/asus-wireless.c:54 asus_wireless_method()
error: uninitialized symbol 'ret'.

drivers/platform/x86/asus-wireless.c

    33  static u64 asus_wireless_method(acpi_handle handle, const char *method,
    34                                  int param)
    35  {
    36          struct acpi_object_list p;
    37          union acpi_object obj;
    38          acpi_status s;
    39          u64 ret;
    40
    41          acpi_handle_debug(handle, "Evaluating method %s, parameter %#x\n",
    42                            method, param);
    43          obj.type = ACPI_TYPE_INTEGER;
    44          obj.integer.value = param;
    45          p.count = 1;
    46          p.pointer = &obj;
    47
    48          s = acpi_evaluate_integer(handle, (acpi_string) method, &p, &ret);
Quoted 3 lines

"ret" isn't necessarily initialized on a couple error paths through this function.

Yes, I have missed that, thanks for catching it! I'll send a fix to this.

#2 lore raw
In reply to Dan Carpenter

Hello Dan,

Quoted 8 lines · Dan Carpenter

Hello João Paulo Rechi Vita,

The patch 2c1a49c96123: "asus-wireless: Toggle airplane mode LED" from Jun 13, 2016, leads to the following static checker warning:

drivers/platform/x86/asus-wireless.c:54 asus_wireless_method()
error: uninitialized symbol 'ret'.

I believe I have a fix for this, but I'm not able to reproduce this message with neither of the following:

make C=2 CHECK="/usr/bin/sparse" drivers/platform/x86/asus-wireless.o make C=2 CHECK="../smatch/smatch -p=kernel" drivers/platform/x86/asus-wireless.o make C=2 CHECK="scripts/coccicheck" drivers/platform/x86/asus-wireless.o

So I am not able to check the fix. How can I reproduce this?

Thanks,

#3 lore raw
Quoted 12 lines · João Paulo Rechi Vita

Hello Dan,

Quoted 8 lines · Dan Carpenter

Hello João Paulo Rechi Vita,

The patch 2c1a49c96123: "asus-wireless: Toggle airplane mode LED" from Jun 13, 2016, leads to the following static checker warning:

drivers/platform/x86/asus-wireless.c:54 asus_wireless_method()
error: uninitialized symbol 'ret'.

Quoted 9 lines

I believe I have a fix for this, but I'm not able to reproduce this message with neither of the following:

make C=2 CHECK="/usr/bin/sparse" drivers/platform/x86/asus-wireless.o make C=2 CHECK="../smatch/smatch -p=kernel" drivers/platform/x86/asus-wireless.o make C=2 CHECK="scripts/coccicheck" drivers/platform/x86/asus-wireless.o

So I am not able to check the fix. How can I reproduce this?

It's some unpublished Smatch stuff... I still have too many false positives.

regards,
dan carpenter