Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1292240pxb; Fri, 18 Feb 2022 04:56:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvFigvuHyWFjFmj9WfQ29m0XayvegNqpJasFATQayHtPo1NfNScKnjgdMJVcginNr7frDv X-Received: by 2002:a63:4f4a:0:b0:36c:704b:a051 with SMTP id p10-20020a634f4a000000b0036c704ba051mr6205953pgl.349.1645188970860; Fri, 18 Feb 2022 04:56:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1645188970; cv=pass; d=google.com; s=arc-20160816; b=mCCVGoefqkQ2mYQgY1fWc7d5xGtYbPBSGUmKdg8tP2XcY0v4mZqyDExhtagcYBPhEv rMfCxyZ6jdbNzaF53QswJskGpsWKCHYSaJRlYlv3wh7mBIQfzUCCBVib/fWYqMFg7+/7 iLoYPUFBmQsZihJwv+zglZXLHcyAyXfXUAyzrq/+PgUFK6EOpEa1nWM38JxLqXQz6IhE CkIoMGlJQkZUxrKt9pByt6eqp6RedqKu8PvFEZoPEll4entB7cwGkvfjJIWRvxKdtYpB 2xNFZezrZYJE2q6Iqm/wsDszE2kRmfK3i8baHCW5deRyvBnWU/EkbfRWGcQ0uCWHMOGx j9lg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=LepwFZoXRCbLFvnZzmH1g6+hDMkPW1Fxp+0YPqZ0p7E=; b=YtYw9Q72rT6eFwDi2JnfT3HhyFtFsWT3Xe0xL5c27AoOnp5OchpieVEA9X3pMxRmjJ 53pSNdUxY47hMvKBt55jVFQWmplM+e6Ga6UPHjHJUi7hI+7eZcSYAlKL/awjd1bZM7QX MqQ6Q3OzjmkA0RPolyZ/MuQMi0NjEyYAYSPPuIqW+bO1qLQnZnvPG1OGmHp+Hh45n+iG Gt+gdc+iXsZsPK56wsHJI4wpjqnWGVO4eUm6hOvE/BaDclFIzoVNbu34BVNQY63J+kUq wiKLZYsaNlMu1KOdbA4coMGD0nH2Vyxw8jEfnASXbXBsSB13pD4TWoylL5gthWZUQtB3 YmCQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=I9lRslby; arc=pass (i=1); 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=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu18si3814052pjb.173.2022.02.18.04.55.56; Fri, 18 Feb 2022 04:56:10 -0800 (PST) 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; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=I9lRslby; arc=pass (i=1); 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=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235194AbiBRM3n (ORCPT + 99 others); Fri, 18 Feb 2022 07:29:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234972AbiBRM3m (ORCPT ); Fri, 18 Feb 2022 07:29:42 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2102.outbound.protection.outlook.com [40.107.22.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 936A333A05; Fri, 18 Feb 2022 04:29:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oM5ZHXTTTZcfsf/rk2dKR0/HkFNNOz1eEpd1fMwHWi9zJgou4+6tg4/Tvm0muA62lH/i/m1t3NQTmJG5PHcnAWFP7GMfpsPTEG/xhwMPRViisNz+cGaW0UGesPN3qfXcCjNkX2z1OW+nCx6NggkGf0vGimFCufESzDGRcjPYf5bsP7W2VCwGI/jNbmdq1pGTnzoGUc/kx8p7kJ8Hf9R5mUu4rDg/HYXOKIimK04P93RS1jPvl8efogCxmxCRf/FNVP6eNduDJj6Cfw6M0WR7OjRjYnAJ/ojqpXz1qMPTC5UT+jdq2yvXCOx847CuYJxsiqw3wD7Ay3dbjGWMlChApw== 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=LepwFZoXRCbLFvnZzmH1g6+hDMkPW1Fxp+0YPqZ0p7E=; b=jl25COQutSdeTOIjgyIPDIMYDPxNQDa8mefqMIYuZZ/BhOUg4OM+ybGPkiijFvgQ5JEwuVYqJdMZzwLaEOtRKHdhcQBtLkuG9MrGuOPVTVMm7IAmvVAfOBhQDfrP9L6UFAwxB0ydGjoTwgWD5kOl4kkABYshqhYxHnMr9p5Wud88SEg7efdtmkdeb14zSJuBAZtEmT1o5UlpnVdv3iL4ln3U1TABMPLbt5F1NQfjZseWxGWxcruPJdnf/nG/Vmsyg6ZWwHK1+s0OowxPOcWtxCbzbA102NE1WhcKVT5oZsMqMmtnrg7n1Y1VO41JYRwIeRpnqmedXmcHSXNeSm/FvA== 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=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LepwFZoXRCbLFvnZzmH1g6+hDMkPW1Fxp+0YPqZ0p7E=; b=I9lRslbyVEHnJsbuPMa3JZoQLeOLjUKjLXjHLYpSq2c20k25JPLCa2vdBR7XHzgSxgMJ+o1NRMX2spsxPJ8jeTlzAK/yeGtJjWtAHlfrIKFrsL1QjAm04DVg8+cF9Vqt+jr0g74Xi1cill0SI7O4D9QaFuIQ/mY5yZo3iek/Ziw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=plvision.eu; Received: from VI1P190MB0734.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:123::23) by HE1P190MB0571.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:5e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18; Fri, 18 Feb 2022 12:29:20 +0000 Received: from VI1P190MB0734.EURP190.PROD.OUTLOOK.COM ([fe80::f16c:7fde:c692:f911]) by VI1P190MB0734.EURP190.PROD.OUTLOOK.COM ([fe80::f16c:7fde:c692:f911%6]) with mapi id 15.20.4995.022; Fri, 18 Feb 2022 12:29:20 +0000 From: Volodymyr Mytnyk To: netdev@vger.kernel.org Cc: Taras Chornyi , Mickey Rachamim , Serhiy Pshyk , Volodymyr Mytnyk , Taras Chornyi , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org Subject: [PATCH net-next] net: prestera: acl: fix 'client_map' buff overflow Date: Fri, 18 Feb 2022 14:29:11 +0200 Message-Id: <1645187351-8489-1-git-send-email-volodymyr.mytnyk@plvision.eu> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: FR0P281CA0080.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::14) To VI1P190MB0734.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:123::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6903b9c-ef44-461e-c5c6-08d9f2da4954 X-MS-TrafficTypeDiagnostic: HE1P190MB0571:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:510; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9hzjWk++6lJc1VN7fb2dnt2CSlokEYmShfaueSKy1QwH3BNpWxJxuU70U7CHCQn08v/miFgZg/91ls4lDBOxmP1drMhGzn+9za2/X+Sw79hr7tzUOxTfr6hx9R5ioqDBh1wlcSwVuXZv4fWh6DDVQzy28Sk53pelTONoCyIuLMuwVZXQLGeL3CifIMsH54TLp+DhpmMz7cjoXOKo2/VyXBj596hta2qWs2yryeUjbvXcuFX720JRs0FgIIF+A44lo4yo1JGjF4Yf1eY03JgV8v3/a5RBsIFUZysYKMkmo30cOLgrQ1XXz/bQNTzhksbtvEpA0UDvA0/MOFKn2ARgA0VklabQ3nQchWKwloJMFKcWGSo/Z6LcZd5YN7SrmgX2wfoKFnnJzDYVQXf6hp8FsbKBNU4zqfEjDC+WxeV62Q5GHgf0dn2LnA1XJ0rip9bGjjKKy+FJbK0FYxpcro7omGb7bPzTDR8q7tJMKI+GeuLXcXafLfoO2tpnQWH7PyKAjDhFw2Qegu2wpa6wmO2lMCxVIapQZWCUUwwsf7/lpd3NAXK3oO5u6O0OGdkRkGO2/D0FNFTZniDH6Zm2qijkRfqIdzX+K2aB+9s6vZN19Kw34rQ4wakHAdiWB0dvwq2pmmBAz/ecCItVRZW5/LevECLA9RAVlSJZPmNHL4YixNUEDhYSTkMS0tbD2YoIu4zJgaeDuZ5FXHFzyta89joLCg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1P190MB0734.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(346002)(136003)(396003)(366004)(39830400003)(376002)(6512007)(6666004)(6506007)(38100700002)(2616005)(38350700002)(36756003)(44832011)(2906002)(5660300002)(8936002)(316002)(54906003)(6916009)(6486002)(4326008)(508600001)(52116002)(26005)(186003)(83380400001)(8676002)(66556008)(86362001)(66946007)(66476007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YgjHRzPXPLsrnHPh9vloNnZrjjeDwLqMQpY6eD4re6ld3nE8nk7rX685dJXS?= =?us-ascii?Q?MFEv/1lK5TKKPyi+Hhp27vUvdq0/t9fhXTkT2/EvqVWnjFqNljvmEF9BxXZx?= =?us-ascii?Q?6BIGtDC5eBw2VXiPdiMxMcTZEikwlGxHoDLOHAJ+4N7FtCUKIyTFmKRAu+N7?= =?us-ascii?Q?cqovTMlrfIDBi1sByOeIVwvnFC/lVIQiCYAT+6WxtggHTV9Hbx0oopJykKMP?= =?us-ascii?Q?8uWBvDj6MGYzoc96dP18gJx9Ql7/JEGUe7iA//VTVvR+bA4Qs8V/GPGJviQN?= =?us-ascii?Q?JDmttir6KQ7plBHbWT7mFuVcGkOjiI6wdvuu/Db72t/hAizAcXGUvQ964ZZh?= =?us-ascii?Q?pDExboxwZrkOXJ5A67bwTamtIsRsb4awuSP793fEVCNaV7UrhojzoowsSyau?= =?us-ascii?Q?+txoU8LFiANjoMfCOCtHZp/jJdTwhk2YSJTkiYmWzhIEcrXmasWd7N5zHgqr?= =?us-ascii?Q?efXMR5ZXJ02pe1f/h9oRUIt2cm9dr0/n3tdYEsFDhKHo3bGUqI1MxZsvYv7c?= =?us-ascii?Q?1iZwd8OKBTShQfKE6GFYdzeQUWJZYX+jN65qUiDoeDBr9u4BhDzvlDhjsH42?= =?us-ascii?Q?t97FwFvGw8SGXqFRlul4oUJnEsjE5keVqBSWnawaZBI2yCUeQieMOX2OpaTj?= =?us-ascii?Q?qHqX5waJN2haJQHB1ztMJSZ2WH7tKupgJ+32imG3nrEPo0C2G7guekKRZXH6?= =?us-ascii?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ussP?= =?us-ascii?Q?mS+Keof8gLIbIIPVnS2mutQRUCreUIJNYz/aK846fCooDDhD5NM7NEpHU7lc?= =?us-ascii?Q?6MxBVw=3D=3D?= X-OriginatorOrg: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: f6903b9c-ef44-461e-c5c6-08d9f2da4954 X-MS-Exchange-CrossTenant-AuthSource: VI1P190MB0734.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2022 12:29:19.9688 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WmVEpgCPfF0g2Zckinr4hhREFqwqPJUUXV5y3/HBTROkWlOAvJHryfDCUVK/p5Y0+5ELPz/pOSDMnBcsDQVwirsRE3d7a1cughq/2Z6dbEY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1P190MB0571 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Volodymyr Mytnyk smatch warnings: drivers/net/ethernet/marvell/prestera/prestera_acl.c:103 prestera_acl_chain_to_client() error: buffer overflow 'client_map' 3 <= 3 prestera_acl_chain_to_client(u32 chain_index, ...) ... u32 client_map[] = { PRESTERA_HW_COUNTER_CLIENT_LOOKUP_0, PRESTERA_HW_COUNTER_CLIENT_LOOKUP_1, PRESTERA_HW_COUNTER_CLIENT_LOOKUP_2 }; if (chain_index > ARRAY_SIZE(client_map)) ... Fixes: fa5d824ce5dd ("net: prestera: acl: add multi-chain support offload") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Volodymyr Mytnyk --- drivers/net/ethernet/marvell/prestera/prestera_acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.c b/drivers/net/ethernet/marvell/prestera/prestera_acl.c index 06303e31b32a..e4af8a503277 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_acl.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.c @@ -97,7 +97,7 @@ int prestera_acl_chain_to_client(u32 chain_index, u32 *client) PRESTERA_HW_COUNTER_CLIENT_LOOKUP_2 }; - if (chain_index > ARRAY_SIZE(client_map)) + if (chain_index >= ARRAY_SIZE(client_map)) return -EINVAL; *client = client_map[chain_index]; -- 2.7.4