remove checks of u32 < 0 in processor_core.c
Subsystems (2)
PATCH 1/1 remove checks of u32 < 0 in processor_core.c
G'day list,
from http://linuxicc.sourceforge.net/
ICC warns about :Pointless comparison of unsigned integer with zero @ lines 552, 742, 782, 788 of processor_core.c
In all four cases this is because of checking if a member "u32 id" of "struct acpi_processor" is negative.
As id is u32 the patch below removes the checks for negative values.
drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c.orig +4 -4
@@ -549,7 +549,7 @@ static int acpi_processor_start(struct areturn_VALUE (0 ); } -BUG_ON ((pr->id >=NR_CPUS ) || (pr->id <0 )); +BUG_ON (pr->id >=NR_CPUS );/* * Buggy BIOS check
@@ -739,7 +739,7 @@ int acpi_processor_device_add(acpi_handlif (!pr)return_VALUE (-ENODEV ); -if ((pr->id >=0 ) && (pr->id <NR_CPUS )) { +if (pr->id <NR_CPUS ) {kobject_uevent (&(*device)->kobj,KOBJ_ONLINE ); }return_VALUE (0 );
@@ -779,13 +779,13 @@ acpi_processor_hotplug_notify(acpi_handlbreak ; } -if (pr->id >=0 && (pr->id <NR_CPUS )) { +if (pr->id <NR_CPUS ) {kobject_uevent (&device->kobj,KOBJ_OFFLINE );break ; } result =acpi_processor_start (device); -if ((!result) && ((pr->id >=0 ) && (pr->id <NR_CPUS ))) { +if (!result && pr->id <NR_CPUS ) {kobject_uevent (&device->kobj,KOBJ_ONLINE ); }else { ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 6 lines · Darren Jenkins
ICC warns about :Pointless comparison of unsigned integer with zero @ lines 552, 742, 782, 788 of
processor_core.cIn all four cases this is because of checking if a member "u32 id" of "struct
acpi_processor" is negative.
As id is u32 the patch below removes the checks for negative values.
This is controversial. At least crypto people like such checks because if later someone will turn a variable into signed one, no new bugs will be introduced. And compiler can optimize away "unsigned int a < 0". Silently or not - that's the question.
To shift you attention away, why do we sometimes BUG, sometimes silently return success?
Quoted 26 lines
drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c.orig +3
-3@@ -549,7 +549,7 @@ static int acpi_processor_start(struct areturn_VALUE (0 ); } -BUG_ON ((pr->id >=NR_CPUS ) || (pr->id <0 )); +BUG_ON (pr->id >=NR_CPUS );/* * Buggy BIOS check @@ -739,7 +739,7 @@ int acpi_processor_device_add(acpi_handlif (!pr)return_VALUE (-ENODEV ); -if ((pr->id >=0 ) && (pr->id <NR_CPUS )) { +if (pr->id <NR_CPUS ) {kobject_uevent (&(*device)->kobj,KOBJ_ONLINE ); }return_VALUE (0 );@@ -779,13 +779,13 @@ acpi_processor_hotplug_notify(acpi_handlbreak ; } -if (pr->id >=0 && (pr->id <NR_CPUS )) { +if (pr->id <NR_CPUS ) {
drivers/acpi/processor_core.c acpi_processor_hotplug_notify(acpi_handl · line 791
Quoted 10 lines
drivers/acpi/processor_core.c renamed from drivers/acpi/processor_core.c.orig +1
-1kobject_uevent (&device->kobj,KOBJ_OFFLINE );break ; } result =acpi_processor_start (device); -if ((!result) && ((pr->id >=0 ) && (pr->id <NR_CPUS ))) { +if (!result && pr->id <NR_CPUS ) {kobject_uevent (&device->kobj,KOBJ_ONLINE ); }else { ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors