lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR11MB46579AE0BB21C2B642DFEBA89B999@DM6PR11MB4657.namprd11.prod.outlook.com>
Date:   Fri, 14 Apr 2023 17:29:00 +0000
From:   "Kubalewski, Arkadiusz" <arkadiusz.kubalewski@...el.com>
To:     mschmidt <mschmidt@...hat.com>,
        "intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
        "Kolacinski, Karol" <karol.kolacinski@...el.com>,
        "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>,
        Simon Horman <simon.horman@...igine.com>,
        "Michalik, Michal" <michal.michalik@...el.com>,
        poros <poros@...hat.com>, Andrew Lunn <andrew@...n.ch>
Subject: RE: [PATCH net-next v2 5/6] ice: remove unused buffer copy code in
 ice_sq_send_cmd_retry()

>From: Michal Schmidt <mschmidt@...hat.com>
>Sent: Wednesday, April 12, 2023 10:19 AM
>
>The 'buf_cpy'-related code in ice_sq_send_cmd_retry() looks broken.
>'buf' is nowhere copied into 'buf_cpy'.
>
>The reason this does not cause problems is that all commands for which
>'is_cmd_for_retry' is true go with a NULL buf.
>
>Let's remove 'buf_cpy'. Add a WARN_ON in case the assumption no longer
>holds in the future.
>
>Signed-off-by: Michal Schmidt <mschmidt@...hat.com>
>---
> drivers/net/ethernet/intel/ice/ice_common.c | 13 ++-----------
> 1 file changed, 2 insertions(+), 11 deletions(-)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_common.c
>b/drivers/net/ethernet/intel/ice/ice_common.c
>index 3638598d732b..c6200564304e 100644
>--- a/drivers/net/ethernet/intel/ice/ice_common.c
>+++ b/drivers/net/ethernet/intel/ice/ice_common.c
>@@ -1619,7 +1619,6 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct
>ice_ctl_q_info *cq,
> {
> 	struct ice_aq_desc desc_cpy;
> 	bool is_cmd_for_retry;
>-	u8 *buf_cpy = NULL;
> 	u8 idx = 0;
> 	u16 opcode;
> 	int status;
>@@ -1629,11 +1628,8 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct
>ice_ctl_q_info *cq,
> 	memset(&desc_cpy, 0, sizeof(desc_cpy));
>
> 	if (is_cmd_for_retry) {
>-		if (buf) {
>-			buf_cpy = kzalloc(buf_size, GFP_KERNEL);
>-			if (!buf_cpy)
>-				return -ENOMEM;
>-		}
>+		/* All retryable cmds are direct, without buf. */
>+		WARN_ON(buf);
>
> 		memcpy(&desc_cpy, desc, sizeof(desc_cpy));
> 	}
>@@ -1645,17 +1641,12 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct
>ice_ctl_q_info *cq,
> 		    hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY)
> 			break;
>
>-		if (buf_cpy)
>-			memcpy(buf, buf_cpy, buf_size);
>-
> 		memcpy(desc, &desc_cpy, sizeof(desc_cpy));
>
> 		mdelay(ICE_SQ_SEND_DELAY_TIME_MS);
>
> 	} while (++idx < ICE_SQ_SEND_MAX_EXECUTE);
>
>-	kfree(buf_cpy);
>-
> 	return status;
> }
>
>--
>2.39.2

Looks good, thank you Michal!

Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ