platform/x86: hp-bioscfg: Remove useless else
Subsystems (2)
PATCH 1/1 platform/x86: hp-bioscfg: Remove useless else
The assignment of the else and if branches is the same, so the else here is redundant, so we remove it.
./drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:545:3-5: WARNING: possible condition with no effect (if == else).
--- .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +2 -8
@@ -541,14 +541,8 @@ void hp_exit_password_attributes(void)struct kobject *attr_name_kobj = bioscfg_drv.password_data[instance_id].attr_name_kobj; -if (attr_name_kobj) { -if (!strcmp (attr_name_kobj->name,SETUP_PASSWD )) -sysfs_remove_group (attr_name_kobj, - &password_attr_group); -else -sysfs_remove_group (attr_name_kobj, - &password_attr_group); - } +if (attr_name_kobj) +sysfs_remove_group (attr_name_kobj, &password_attr_group); } bioscfg_drv.password_instances_count =0 ;kfree (bioscfg_drv.password_data);
Signature · 1 line
2.20.1.7.g153144c
Ilpo Järvinen
maintainerQuoted 22 lines · Jiapeng Chong
The assignment of the else and if branches is the same, so the else here is redundant, so we remove it.
./drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:545:3-5: WARNING: possible condition with no effect (if == else).
Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +0
-3@@ -541,14 +541,8 @@ void hp_exit_password_attributes(void)struct kobject *attr_name_kobj = bioscfg_drv.password_data[instance_id].attr_name_kobj; -if (attr_name_kobj) { -if (!strcmp (attr_name_kobj->name,SETUP_PASSWD )) - sysfs_remove_group(attr_name_kobj,
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c void hp_exit_password_attributes(void) · line 548
Quoted 10 lines
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +2
-5- &password_attr_group); - else - sysfs_remove_group(attr_name_kobj, - &password_attr_group); - } +if (attr_name_kobj) +sysfs_remove_group (attr_name_kobj, &password_attr_group); } bioscfg_drv.password_instances_count =0 ;kfree (bioscfg_drv.password_data);
While this is a valid observation, I wonder why you didn't change the create side too?
I hope it's not because you never took a look to understand the SETUP_PASSWD related code, it'd be pretty impossible to not notice it. This could have just as well have been a bug with inconsitent pairing against create side, which is why reports from automated tools must not be implemented blindly but the related code must be understood first.
Signature · 1 line
i.
Lopez, Jorge A (Security)
maintainerThe redundant code is a remnant code from test phase.
I concur with your changes which were approved in a separate email.
Regards,
Jorge Lopez
HP Inc
"Once you stop learning, you start dying"
Albert Einstein
Quoted 63 lines
-----Original Message-----
From: Ilpo Järvinen <[email protected]>
Sent: Friday, August 11, 2023 3:04 AM
To: Jiapeng Chong <[email protected]>
Cc: Lopez, Jorge A (Security) <[email protected]>; [email protected]; [email protected]; platform-driver- [email protected]; LKML <[email protected]>; Abaci Robot <[email protected]>
Subject: Re: [PATCH] platform/x86: hp-bioscfg: Remove useless elseCAUTION: External Email
Quoted 4 lines · Jiapeng Chong
The assignment of the else and if branches is the same, so the else here is redundant, so we remove it.
./drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:545:3-5:
WARNING: possible condition with no effect (if == else).
Quoted 22 lines
Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +0
-4@@ -541,14 +541,8 @@ void hp_exit_password_attributes(void)struct kobject *attr_name_kobj = bioscfg_drv.password_data[instance_id].attr_name_kobj; -if (attr_name_kobj) { -if (!strcmp (attr_name_kobj->name,SETUP_PASSWD )) -sysfs_remove_group (attr_name_kobj, - &password_attr_group);drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c void hp_exit_password_attributes(void) · line 548
Quoted 10 lines
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +3
-4-else -sysfs_remove_group (attr_name_kobj, - &password_attr_group); - } +if (attr_name_kobj) +sysfs_remove_group (attr_name_kobj, + &password_attr_group); } bioscfg_drv.password_instances_count =0 ;kfree (bioscfg_drv.password_data);While this is a valid observation, I wonder why you didn't change the create side too?
I hope it's not because you never took a look to understand the
SETUP_PASSWDrelated code, it'd be pretty impossible to not notice it. This could have just as well have been a bug with inconsitent pairing against create side, which is why reports from automated tools must not be implemented blindly but the related code must be understood first.--
i.
Regards,
Jorge Lopez
HP Inc
"Once you stop learning, you start dying"
Albert Einstein
Quoted 49 lines
-----Original Message-----
From: Jiapeng Chong <[email protected]>
Sent: Friday, August 11, 2023 1:30 AM
To: Lopez, Jorge A (Security) <[email protected]>
Cc: [email protected]; [email protected]; platform-driver- [email protected]; [email protected]; Jiapeng Chong <[email protected]>; Abaci Robot <[email protected]>
Subject: [PATCH] platform/x86: hp-bioscfg: Remove useless elseCAUTION: External Email
The assignment of the else and if branches is the same, so the else here is redundant, so we remove it.
./drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:545:3-5:
WARNING: possible condition with no effect (if == else).Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +3
-9@@ -541,14 +541,8 @@ void hp_exit_password_attributes(void)struct kobject *attr_name_kobj = bioscfg_drv.password_data[instance_id].attr_name_kobj; -if (attr_name_kobj) { -if (!strcmp (attr_name_kobj->name,SETUP_PASSWD )) -sysfs_remove_group (attr_name_kobj, - &password_attr_group); -else -sysfs_remove_group (attr_name_kobj, - &password_attr_group); - } +if (attr_name_kobj) +sysfs_remove_group (attr_name_kobj, + &password_attr_group); } bioscfg_drv.password_instances_count =0 ;kfree (bioscfg_drv.password_data); --2.20.1.7.g153144c