Message ID | 20230811062957.82728-1-jiapeng.chong@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp900263vqi; Thu, 10 Aug 2023 23:55:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2EzcZdfxY1V9XGb/boPdITNAanxrpILeNI/fFh3vUX+8ersc3vWMU/KR5oBIJHxuBuI+X X-Received: by 2002:a05:6a20:939c:b0:12c:e745:78b3 with SMTP id x28-20020a056a20939c00b0012ce74578b3mr865270pzh.62.1691736958657; Thu, 10 Aug 2023 23:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691736958; cv=none; d=google.com; s=arc-20160816; b=08lXAI8opMlCCVtL6HiE+xvrILgkusm5+AWjPzVA9LEGOiDF78Z1AUBDCsW0968CuV V79tF+9MNA8OJqf6wCNM93yew5GmCLrzmff6YXe1pLpeEEfEdY0MtrHjxfTXrlEc089l Bb+1FRXZQVtQkq13dcKaUyzS1T5+skaMksHLAapBr7x7pagW8TlcIcTp3ImcsUcXr2CS Phl2NRlc9jGLa5HARiiJJYJ9mZrvR7cp32ELBa1AHuf45xau9RGqZkO/R6v+sC+b98E0 nHVOHi96cEb167fHEmulmAZ/AOdM3/YW7neZE6lh5zSg5JcakX3uug1H+P8uhp+D0Ndp 34yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hB7XDgNJkCeTRg9AmXki0ZFqdyYhuMbuabf76s59Owc=; fh=IzHwN15QKASbURdmMEckO4UBBivyq9A+aAzVUCTvtNw=; b=G5xbFmuPCx8zlU3RYWfuL7EA/2FuLMXfTTKBimzg6cI8csZ0GTUl9nhJw5WDyVR6EW o9vwqqXgjVitpAJZRPNZdR1X6UbPd3E+AKqwEHEEtOail81Q7/OifdCVRq3Y/zKovCkU cz4zaImIFGNZBFYOOph+cVTzuVRXeV7luejIXwFfqtJhu1Ocg+3WwGKqZKIx5UTDb1dz cbioVg/ThjQLh/1TBKLPDuLSRXzGxemr428vwhlkie/HbKvdatkomf1t7DEbu8YAWOW+ Gjlm1GPX7ENDKU/VMk8TkS2xB+6Ug7MgYTpcb01YNTwLq9kxOB1dGFtPO/Wm0Sd9JO5W +KIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a170902ec8a00b001bbbd9cd44bsi3146425plg.79.2023.08.10.23.55.45; Thu, 10 Aug 2023 23:55:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbjHKGaT (ORCPT <rfc822;shaohuahua6@gmail.com> + 99 others); Fri, 11 Aug 2023 02:30:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjHKGaR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 02:30:17 -0400 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F232A10D; Thu, 10 Aug 2023 23:30:15 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R531e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VpWG8Xa_1691735398; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VpWG8Xa_1691735398) by smtp.aliyun-inc.com; Fri, 11 Aug 2023 14:30:12 +0800 From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> To: jorge.lopez2@hp.com Cc: hdegoede@redhat.com, markgross@kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong <jiapeng.chong@linux.alibaba.com>, Abaci Robot <abaci@linux.alibaba.com> Subject: [PATCH] platform/x86: hp-bioscfg: Remove useless else Date: Fri, 11 Aug 2023 14:29:57 +0800 Message-Id: <20230811062957.82728-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773914773405083053 X-GMAIL-MSGID: 1773914773405083053 |
Series |
platform/x86: hp-bioscfg: Remove useless else
|
|
Commit Message
Jiapeng Chong
Aug. 11, 2023, 6:29 a.m. UTC
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 <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
.../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
Comments
On Fri, 11 Aug 2023, Jiapeng Chong wrote: > 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 <abaci@linux.alibaba.com> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> > --- > .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > index 03d0188804ba..771e554182dc 100644 > --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > @@ -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); 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.
The 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 > -----Original Message----- > From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > Sent: Friday, August 11, 2023 3:04 AM > To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> > Cc: Lopez, Jorge A (Security) <jorge.lopez2@hp.com>; > hdegoede@redhat.com; markgross@kernel.org; platform-driver- > x86@vger.kernel.org; LKML <linux-kernel@vger.kernel.org>; Abaci Robot > <abaci@linux.alibaba.com> > Subject: Re: [PATCH] platform/x86: hp-bioscfg: Remove useless else > > CAUTION: External Email > > On Fri, 11 Aug 2023, Jiapeng Chong wrote: > > > 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 <abaci@linux.alibaba.com> > > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> > > --- > > .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 > > ++-------- > > 1 file changed, 2 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > > b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > > index 03d0188804ba..771e554182dc 100644 > > --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > > +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > > @@ -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); > > 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. > > -- > i.
Reviewed-by: Jorge Lopez <jorge.lopez2@hp.com> Regards, Jorge Lopez HP Inc "Once you stop learning, you start dying" Albert Einstein > -----Original Message----- > From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> > Sent: Friday, August 11, 2023 1:30 AM > To: Lopez, Jorge A (Security) <jorge.lopez2@hp.com> > Cc: hdegoede@redhat.com; markgross@kernel.org; platform-driver- > x86@vger.kernel.org; linux-kernel@vger.kernel.org; Jiapeng Chong > <jiapeng.chong@linux.alibaba.com>; Abaci Robot > <abaci@linux.alibaba.com> > Subject: [PATCH] platform/x86: hp-bioscfg: Remove useless else > > CAUTION: 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 <abaci@linux.alibaba.com> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> > --- > .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > index 03d0188804ba..771e554182dc 100644 > --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c > @@ -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
diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c index 03d0188804ba..771e554182dc 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c @@ -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);