From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16C1D18A6C1 for ; Tue, 7 Jan 2025 11:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736249337; cv=none; b=ayaQq3OrXifY/0Jk5BrKigqC0OjJvkUNqiS96kaVYtQB3ryeFRJeeRArSqRRqpnp6RokwICGTGnzwjgxcrBHGt2l71+KPumnAofcCLSzPpZqntSpDyuE6ILXwM5zxCieezHhzFx+LkBcP1/iFwnfLCH0KCFM08+0xe2PtDyNUfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736249337; c=relaxed/simple; bh=a/nUa1LpYlu8s73KEhuvs+6oTFnQ69UQk445ZrCficQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JR5H+9IhIShpb0ISXVseNloeGM1wMGLngY6RzogTicllRHeHK/sMfeNSC75HQ4ewYCCYrugP2FnXYQhhg3wmrj0qkjq8nLrjllz0NtbRQdvoPY4ft1m0Tuu0DrLI+DPAnxtKGA3sqz1a8UiiUpIP5S9VOtT/aKBclGAxFBmnyLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gImPgzFW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gImPgzFW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF24DC4CED6; Tue, 7 Jan 2025 11:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736249336; bh=a/nUa1LpYlu8s73KEhuvs+6oTFnQ69UQk445ZrCficQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gImPgzFWKdaLfhzGloiicMj18CgRTePlPywu2sxqZzJB7pXfAAPZTTzPlM2C7keyA AAwwEKlIqBk+qKD6ZN670879wOhRm2SVeuE1Q5WW5BVoso2KdTqx5BOD6XMEKOpQD7 vcrMImtbS9DRqzk2wHZjJp7TnPk+xw2R6tOrquuOIIxtuzSEVLhvw4KxP1I9u2r0mR A0zSxUozsvlgs/KDIbGMSn3t5vIhlNGvSN2Teu0WhSqU4STXkemsvEqruKTHLnWZ/4 efI7l28N48n3OW3n7inOwPcRKmfyLLpiDbkhBA049t33h1iAmYfpV3CFTvjUg/Xk7T hk7erpGh03HAw== Date: Tue, 7 Jan 2025 11:28:51 +0000 From: Simon Horman To: "Russell King (Oracle)" Cc: Andrew Lunn , Heiner Kallweit , Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jose Abreu , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: Re: [PATCH net-next v2 03/17] net: stmmac: use correct type for tx_lpi_timer Message-ID: <20250107112851.GE33144@kernel.org> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jan 06, 2025 at 12:24:58PM +0000, Russell King (Oracle) wrote: > The ethtool interface uses u32 for tx_lpi_timer, and so does phylib. > Use u32 to store this internally within stmmac rather than "int" > which could misinterpret large values. > > Since eee_timer is used to initialise priv->tx_lpi_timer, this also > should be unsigned to avoid a negative number being interpreted as a > very large positive number. > > Also correct "value" in dwmac4_set_eee_lpi_entry_timer() to use u32 > rather than int, which is derived from tx_lpi_timer, even though > masking with STMMAC_ET_MAX will truncate the sign bits. u32 is the > value argument type for writel(). > > Signed-off-by: Russell King (Oracle) ... > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 9a9169ca7cd2..b0ef439b715b 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -111,8 +111,8 @@ static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE | > NETIF_MSG_IFDOWN | NETIF_MSG_TIMER); > > #define STMMAC_DEFAULT_LPI_TIMER 1000 > -static int eee_timer = STMMAC_DEFAULT_LPI_TIMER; > -module_param(eee_timer, int, 0644); > +static unsigned int eee_timer = STMMAC_DEFAULT_LPI_TIMER; > +module_param(eee_timer, uint, 0644); > MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec"); > #define STMMAC_LPI_T(x) (jiffies + usecs_to_jiffies(x)) > Hi Russell, now that eee_timer is unsigned the following check in stmmac_verify_args() can never be true. I guess it should be removed. if (eee_timer < 0) eee_timer = STMMAC_DEFAULT_LPI_TIMER; Flagged by Smatch. ...