From patchwork Sat Jun 8 10:20:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erick Archer X-Patchwork-Id: 13690988 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03olkn2100.outbound.protection.outlook.com [40.92.59.100]) (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 A2F5F6D1B9; Sat, 8 Jun 2024 10:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.59.100 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717842055; cv=fail; b=t4Q8HoBRE2zp4yD1J8Cve0HVQEs7V/l23fqi8760tffAMi/R7hHhhsIvwZ56N/6EnLkSQfdsEh7rBJWyz6vIpAErhsgVqailjjg+QWfYyBpxRv+ZoIELnxcAGAEME1D11i493Q8pkvCL4Wg7yqcHQWubyW8lIKV5L6C2qGPQuVY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717842055; c=relaxed/simple; bh=8seKpHwQlbYJ+28J0PbbqWmxSvq9q3QjlBIyD5lg4Bc=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=tVDfYxDtZMznjiDTHdo+ahQR4dxsET2teRS2wLo/DMcPGI8dUJoSWwhXUnTCdDrOtA9XM9debPi4fd41Fj3uPi+aLwen3HfrJRnPdog0FhNc9wjN/v4g22dUOs6ApH3KRTv3u3F64cKyZ+7ecwTXapyYOxx20n3j7O2HsvZbQ8Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=bxOcadDS; arc=fail smtp.client-ip=40.92.59.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="bxOcadDS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6SDbRHxsZI59dyhhOzaxmsgst0CnJz7CETdpQ8UDhQOuIWVGuokfGG9J8BJJSmFxzjryBN+S2OACgoxYLc/EOMtm6C0cn5P99Jf9aAPnfyzo0zyTKC7zo7ha+ZmimGno+EcgjPPT2UikPSxq48ebyoN3ShaV0lpbqJlRGqgHlfr94fgVmjmeL9ujGZeZTXSdeN2GR7iTvd4djbvrX3emXzXHmpdcs7hEZzLt1qm6F7koTIuc64GJ6uGiAx3wa7/3eEfI9y78Mn/DrRddAm8vYYSyyyYRzjfezcSJop1/2BNejVqleb5+TerZekuHP92N6IwS6SJIHPiztkBBegigA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R4MAi3qupd5a/zPJ5EmNQarPAzWOexHBbVMVLwF6T04=; b=IPeVpeXi6RPnui3nZjGAMlZWVa9TGX0lCVgkTYTcgxMuuKORKWluoZqbc5BtdKEi0N1c1eIrj+Z+Y+5P2BKcjOcYwfvW8GU/jdOb33/aEd6X9Zawvgsi9WOwCpqspmeCVdqNTGVYeuaqlMU5oggg3OdK+Eb+1TatxBQ11Erki1goKxDQrD4t+fFYpzH8eGnEbTLqYF7RnPHV+iy1J/icZ5fo0EaszqwUY/y7tNX/zrhX+Hr4Yr8eJNt1gaWadu7s8sbznGuNW7KBXJusAIjv2tIcBm2slHdu26jJdsU4UHezMT4gtX7wxXNPz7OH59ur1iWvVrWW/7hrtHS5CqocOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R4MAi3qupd5a/zPJ5EmNQarPAzWOexHBbVMVLwF6T04=; b=bxOcadDSetVB0zghWdM4jcLKfA6I47nR5Sr/b6JOyBf02FLBETCNdpFvTZoAxT8QWIVttboon0KyDNXaDguBH+jWQ3P6K1PhRMAiybD98w/Ng1OYMakIproILBaRDm/nMAXPTQ4igx+5LOeS+b+9QQVeVvKRrA77Wx9KBcUhgy/XYry7vmsPuiFmZ3wODiJAMGbXbFL22m4XbWRc4xctV/1XM5JoGIj1la+TUtnJ4awUj+PBtdHI+2AwH/7mGPwRzPkvLWo490JXBmiBS4ZmI2YsLcnBtsioAVwM6fcecQg5ENncaAFtIczZ9tm87j4UD+DauyuM8qi8iJVqYw8/xw== Received: from AS8PR02MB7237.eurprd02.prod.outlook.com (2603:10a6:20b:3f1::10) by DU0PR02MB9612.eurprd02.prod.outlook.com (2603:10a6:10:423::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Sat, 8 Jun 2024 10:20:50 +0000 Received: from AS8PR02MB7237.eurprd02.prod.outlook.com ([fe80::409b:1407:979b:f658]) by AS8PR02MB7237.eurprd02.prod.outlook.com ([fe80::409b:1407:979b:f658%5]) with mapi id 15.20.7633.036; Sat, 8 Jun 2024 10:20:49 +0000 From: Erick Archer To: Daniele Venzano , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kees Cook , "Gustavo A. R. Silva" , Justin Stitt Cc: Erick Archer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] ethernet: sis900: use sizeof(*pointer) instead of sizeof(type) Date: Sat, 8 Jun 2024 12:20:33 +0200 Message-ID: X-Mailer: git-send-email 2.25.1 X-TMN: [6+gLbE+DO8EHjGxZPd3nMflYuFiZkhIf] X-ClientProxiedBy: MA2P292CA0011.ESPP292.PROD.OUTLOOK.COM (2603:10a6:250:1::15) To AS8PR02MB7237.eurprd02.prod.outlook.com (2603:10a6:20b:3f1::10) X-Microsoft-Original-Message-ID: <20240608102033.4886-1-erick.archer@outlook.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR02MB7237:EE_|DU0PR02MB9612:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b8bf23b-92cc-4681-e32c-08dc87a4aab8 X-Microsoft-Antispam: BCL:0;ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: Yxm+GzbSGMfG0mquHWs5F2k/u4uUC51sgjREGDmOJP1Cip07NtFIEkWEksrLpNEmJ/ptPnszVR8t6FgMfYQABxGzdPfgT2phsD3NMTjC5XAXlKupuIqyNM/LFjqU1ylfAEO2AUy4xPelKtCkcVgi2DOqUAI8DfeNg+1+DNWRgI75241j4jTz36as5IODPE+ZlCYZsSUcZOpJ2sAzhEHnlXicXetafT+Ayzj5hhTC1RaP58Foa3WuaY+0DZ14a9aJ8uBvkP7ssIKncJReLJV6z2SBd/UIEoTccDJFU1XFtoD2r+26W+pMReseW/KIXj6gs1VvbvSK9zgRrLj+cfcl98StGvZE7Jcl/cgDlcCCPMK7PHvsqRawe1Ow4ritfGPmSK6bU7sBjb6ameNDwRFLwTsKE4GLzkBwpsQnRd7gwBAgNWnFC+on/AzqNko2DkmGZ4ghLaTtA5R/AHLb32E7RgsvwX2p423FdIMzDS/6gPY/54sUUQGoH0pVGOOTa/xqmouJ9BvE8RcZaQ9sQ3ic6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9OcmII5iFGeF/M59yHpDpNi9OAuUQ7P1setmH9YF7/2urQuw+1GZ/p6C10itWTy+meGx64XN+PDL/ZRx9sGy5ZTKe6dc4bbwRk8d66euiZO9hc4i8/lbj+2Vzi1fLiNMD88MoWoFq16Mu3Ts7Cc5+StTNTvAb6wjh2BxcaSMV8q7IWi8cI7DYOtZy2czYB6nNwhJS3GW5MXctvMDGHIVsQOokYOYpvRVbbHEtfxppxuM0uEN/faK/iHStzugu1I2x7SsX9+/Cpue1x5IgblcVE6wyPc17QHotcL0WoewgLcpnn1GDBhmTUDxFJ7yWb24dyudjvBdbsCTcrD X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b8bf23b-92cc-4681-e32c-08dc87a4aab8 X-MS-Exchange-CrossTenant-AuthSource: AS8PR02MB7237.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2024 10:20:49.0575 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR02MB9612 It is preferred to use sizeof(*pointer) instead of sizeof(type) due to the type of the variable can change and one needs not change the former (unlike the latter). At the same time remove some unnecessary initializations and refactor a bit to make the code clearer. This patch has no effect on runtime behavior. Signed-off-by: Erick Archer --- drivers/net/ethernet/sis/sis900.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c index 85b850372efe..5b82c4763de9 100644 --- a/drivers/net/ethernet/sis/sis900.c +++ b/drivers/net/ethernet/sis/sis900.c @@ -614,11 +614,10 @@ static int sis900_mii_probe(struct net_device *net_dev) /* search for total of 32 possible mii phy addresses */ for (phy_addr = 0; phy_addr < 32; phy_addr++) { - struct mii_phy * mii_phy = NULL; + struct mii_phy *mii_phy; u16 mii_status; int i; - mii_phy = NULL; for(i = 0; i < 2; i++) mii_status = mdio_read(net_dev, phy_addr, MII_STATUS); @@ -630,7 +629,8 @@ static int sis900_mii_probe(struct net_device *net_dev) continue; } - if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) { + mii_phy = kmalloc(sizeof(*mii_phy), GFP_KERNEL); + if (!mii_phy) { mii_phy = sis_priv->first_mii; while (mii_phy) { struct mii_phy *phy;