From patchwork Mon Mar 29 14:14:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Manoil X-Patchwork-Id: 12170239 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB6A3C433DB for ; Mon, 29 Mar 2021 14:15:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B135C61922 for ; Mon, 29 Mar 2021 14:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230167AbhC2OPb (ORCPT ); Mon, 29 Mar 2021 10:15:31 -0400 Received: from mail-eopbgr80050.outbound.protection.outlook.com ([40.107.8.50]:4675 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229555AbhC2OO6 (ORCPT ); Mon, 29 Mar 2021 10:14:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGmRan4sJ+B/TtjUY8515lBuhpdSZHpPdPxVF9TjqqDMAiy7vATCJ6mWTeRgGfd/bNeJ1969D4OxC07JqpXyIatWNatCevOVRB5DVkK+Z5g4p5g0YwcrS+6kwUUVmIEErs6SWsXXYxDWLWEBVlsRZfMV6knudOVmyGWwGWnOm2jQyuwfjm2ayoyhhFvrOEkKOFo1wUPnpRDJx2tyGYbCUPfdDWsobiTMeTlLv+7v/zj1mw5yFAqwskO+zQf/lnLe8+IlGbqZ9H0z/IeYXnh2/y2CxuHwbs+SfPH6zdbdd91MiZhF1NIidusPTQs99XsCAMMgHaGgnbkw5EdqghpVhg== 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-SenderADCheck; bh=7ONkY6QtLb90VYMvdLYODmirklQNfPJUt8WmnvwJsKs=; b=Lw/DgUScmZ13+q8A7MlicLQh054MpzHr221PG/cKPi4vsjEy9OA+skW5HfYosfibG6zGFfPBxnpCG0TynFPYjNb0dxMqpOP7d9a5GsNSsUwIjmuGusbASlFudK9Iu7sbV+mhUYmPgJ2Duij7b+uS1bapwcYmkvp4IRcaIfoozZ/sZuJZw2xDEYAW020LH1WUyV5KBHcvRa7noXRHG21WZ8W0HdIVRZzLX7cl3YgDbrQjUUmOkJjjmaAZA3ME47Tp6ek7JX+4W8MVpWs7em0+6mY8/iO2JIWA6O0bxaZHQ6h9Tp4/YdN9D5U3H637wyahMk4X/u+gN60kn3JNJq9wZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7ONkY6QtLb90VYMvdLYODmirklQNfPJUt8WmnvwJsKs=; b=PMxmLiKR50piO9xhONUw3lKYd3aav/iKaNt7RRFOgComIvnOxTupgv5P1r2FjWLAppUsuHb4n1vBJnbYGIzW44PdM6OmI3Dwy2c4uP5pTFfwjvlDBcSRVK4zARkUv7WMVFc/eXj2upYwMFjaQ6gZtqhl1WomhpBuIze6k7T2N1Q= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6754.eurprd04.prod.outlook.com (2603:10a6:208:170::28) by AM9PR04MB7585.eurprd04.prod.outlook.com (2603:10a6:20b:280::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.31; Mon, 29 Mar 2021 14:14:56 +0000 Received: from AM0PR04MB6754.eurprd04.prod.outlook.com ([fe80::542d:8872:ad99:8cae]) by AM0PR04MB6754.eurprd04.prod.outlook.com ([fe80::542d:8872:ad99:8cae%6]) with mapi id 15.20.3977.033; Mon, 29 Mar 2021 14:14:56 +0000 From: Claudiu Manoil To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S . Miller" , Vladimir Oltean Subject: [PATCH net v2] enetc: Avoid implicit sign extension Date: Mon, 29 Mar 2021 17:14:43 +0300 Message-Id: <20210329141443.23245-1-claudiu.manoil@nxp.com> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [83.217.231.2] X-ClientProxiedBy: AM0PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::18) To AM0PR04MB6754.eurprd04.prod.outlook.com (2603:10a6:208:170::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv15141.swis.ro-buh01.nxp.com (83.217.231.2) by AM0PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Mon, 29 Mar 2021 14:14:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 68c5d1fa-fa5a-4d82-1c25-08d8f2bd0770 X-MS-TrafficTypeDiagnostic: AM9PR04MB7585: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U5Zpan6iO22vkaH8qqYIma1/fCDbDxBz0FwRVsS+27bUK9jHf3agpHPUSYeTO39Re6gEg118TfExMRF+dvNUJJ7FDtESHh5pmnsnyYiKNJhh0WhLq8qpSZfyNkcx+2I9Rbw87VNTqXCeR5MknWYmvYZZmI0IzBJw5QZlIwvGitUxlvSjZmmRhrDvZQ2g81U0XK0IF2wwnbSkC3QI2Z6eB0f0CLuTIMNOTYKm2ypNiKFy26/X6IiwcwE4rL36z+QKBQ/LJ9ND6C5AEnmpFe4n47l5Us7IIBZyjiMDe7QTmz84JHkH4zBCQG4FW0++ySW5LZZLPkLdI/akpPJA4q6qJLwV8TA04PLnvKwTccqAbXLaUp8mpeGFy+Rqb/ZjDcvG43PhCiDmaZwL5r5rD5P8v+O0jq+pXSYCznl+LxHojVF+KUetEILV3ty6tdSoNUY79YIrw/zPBeWlEfbpdwDtDdxI2Cp1/oPdaY7X7k3nChMzDMCdXinW0EEW60UaVoxnO86jTwd0CoEzJ3lm91az5UxFdFPbatrjYqIvlyyAGvNZazkcw7s6mDzBHC0KVeoIY34t8q/MLI+7DyO3Sx34EWzaPDOUZjdLnEtE0mwyoSLkADl2WpRJqXBWcHneWIiXnnxLcwP9wSeK9/dVcCTj8xeAdSfBi36tb+oulBqxxsU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6754.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(346002)(39850400004)(136003)(366004)(376002)(1076003)(66556008)(4326008)(66946007)(5660300002)(52116002)(186003)(36756003)(478600001)(6486002)(44832011)(83380400001)(16526019)(6916009)(2616005)(54906003)(956004)(6666004)(26005)(8676002)(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NRt2ibLSaMyrlr6seDKSjs8C+iY0ZZyeoZ2lDn+6jZXLH/gln2OO4IJrX069vZW/UC+Bvthh0fkx9gCE3236ClB5OqiVwaHYbfR6vrOoXkJZTedBsQfoalmUUsGU/bkDrbPsheCYagfANMwzt3dOqN/LDqMUaNigli/XG7ER2X2MR3t054K1XTQu3Zz6ajiMw+h/gW9hGJ+W3WyHjUl7zBtlekL+m8ircVK1setgDMd0uQ6egZidRQ7JxtC9qQfNWuBYMW2sDl8fkrXfxpY4WKyP1Zjs1oCN1BGpcW9RZlFT82yEkT6i/MyQoKVWfoBBE5CBz0v0hTMI56Xm3sDb4hm+Q2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68c5d1fa-fa5a-4d82-1c25-08d8f2bd0770 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6754.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2021 14:14:56.1782 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iB/O/uwPNBuM5f+te0v8LvMvVJB2e9MSYjlf1XD5K0GNUkC5K/simNRBxMK2BExVw1mNh3p6j/OyX4VblO6zjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7585 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Static analysis tool reports: "Suspicious implicit sign extension - 'flags' with type u8 (8 bit, unsigned) is promoted in 'flags' << 24 to type int (32 bits, signed), then sign-extended to type unsigned long long (64 bits, unsigned). If flags << 24 is greater than 0x7FFFFFFF, the upper bits of the result will all be 1." Use lower_32_bits() to avoid this scenario. Fixes: 82728b91f124 ("enetc: Remove Tx checksumming offload code") Signed-off-by: Claudiu Manoil --- v2 - added 'fixes' tag drivers/net/ethernet/freescale/enetc/enetc_hw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 00938f7960a4..07e03df8af94 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -535,8 +535,8 @@ static inline __le32 enetc_txbd_set_tx_start(u64 tx_start, u8 flags) { u32 temp; - temp = (tx_start >> 5 & ENETC_TXBD_TXSTART_MASK) | - (flags << ENETC_TXBD_FLAGS_OFFSET); + temp = lower_32_bits(tx_start >> 5 & ENETC_TXBD_TXSTART_MASK) | + (u32)(flags << ENETC_TXBD_FLAGS_OFFSET); return cpu_to_le32(temp); }