From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 116D0A0588; Thu, 16 Apr 2020 19:15:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C02321DDD0; Thu, 16 Apr 2020 19:15:20 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60077.outbound.protection.outlook.com [40.107.6.77]) by dpdk.org (Postfix) with ESMTP id E83231D94E; Thu, 16 Apr 2020 19:15:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YlfSV4FipVYwL6Mtppk6uAHAn24Yk2OBFGeqhds/PvyrbGaf3LAefK6S4H0aUB5OhnV5uLkLXYQzMKDAFp3xQuPlDKX+D850CFYhcrv+fkNveSCeAtzO2HnZV726Y+p/oNx/k2CZZADRS+XNM+t5d0JjhdQNYHBgTlyak4IWKH5ZhYFlbmUE/xQmc7NWuY7oeRObwgWTE0rllHtENrNEh2/2D7fanAoHk8NZ2iSwhuZ4/LwFHTlu0m4fF//+lOjeXFI0qqHEMKKp1CpE2NQiIFUtpcPBn45dYavNL1rfjIHFZc3ZwBfDJibphkgEf43fqvFPddUmuNJb3j0M0yZvkA== 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=JDbrhQfoe8G3d7irSEVbIMNA1IoWvsQODURkCxxK31Q=; b=EgttHujXzO74YnnCq4KH68W5PuW0DiB4+3azjmMKw2U7q3XFjNdRqbgPKIEaI2aG3lm2/IluD031/MHAzYPsZO/9wNea7N9oiE7tKWHFVonqzKzSb1+1svYrKUFw8HgYDi+CcpCyDw8IUV9Hq7nO1DYhMQcUBi/1W54tCHx7eiGr71mwstej43p3ZP1rPDOH6qphasjFPtEu4AU/vdYLMCbBpcjAaXEW3RVZnEMc6RmLMZoRCWH2TnOadmBvKPHAIolL9eWzTwYDGi+lM4n4jOC6PdDubm46w4iNy7lab0DxEq9pgXJ6NbSZxmggggdr20mnS8gw62BHVV/1A7lCQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JDbrhQfoe8G3d7irSEVbIMNA1IoWvsQODURkCxxK31Q=; b=FhG34L+7CAsl3hwJsbXnnQeQKjWr2Ni0+w/wAKuOLDseSdoltzYmXwc5Ti+xjxTLdzgbCHbEjDMp/3JyM/yt47jZ8KeW0KrEbDNSBkAOZyvipgIEzfJXyfTs35A/aQWKsThOC4A6NOxufCeq8qEfBbjC5pfOdmhqFl3M6Cpyuhw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=asafp@mellanox.com; Received: from VI1PR05MB5693.eurprd05.prod.outlook.com (2603:10a6:803:d9::23) by VI1PR05MB3198.eurprd05.prod.outlook.com (2603:10a6:802:1c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.26; Thu, 16 Apr 2020 17:15:18 +0000 Received: from VI1PR05MB5693.eurprd05.prod.outlook.com ([fe80::f50f:1ae4:52bb:ce7b]) by VI1PR05MB5693.eurprd05.prod.outlook.com ([fe80::f50f:1ae4:52bb:ce7b%7]) with mapi id 15.20.2900.028; Thu, 16 Apr 2020 17:15:18 +0000 From: Asaf Penso To: dev@dpdk.org Cc: viacheslavo@mellanox.com, dekelp@mellanox.com, stable@dpdk.org Date: Thu, 16 Apr 2020 17:15:09 +0000 Message-Id: <1587057309-2947-1-git-send-email-asafp@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain X-ClientProxiedBy: PR0P264CA0213.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1f::33) To VI1PR05MB5693.eurprd05.prod.outlook.com (2603:10a6:803:d9::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR0P264CA0213.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1f::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Thu, 16 Apr 2020 17:15:17 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dc252b8e-6a87-496d-344d-08d7e229bc8e X-MS-TrafficTypeDiagnostic: VI1PR05MB3198:|VI1PR05MB3198: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-Forefront-PRVS: 0375972289 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR05MB5693.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(376002)(39860400002)(478600001)(66946007)(66476007)(2616005)(36756003)(8676002)(956004)(6666004)(66556008)(8886007)(186003)(8936002)(4326008)(316002)(81156014)(16526019)(5660300002)(6916009)(86362001)(52116002)(7696005)(55016002)(26005)(2906002)(450100002); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1n6YywMOA7mLVB+xHUfEAMkz2eYAURAwBSX8f+4nt5pEiSQBcLiqxCdse3j9nDmbPqhpgAcFdRDgLYmNaFccOwBqEPEKcGeTola3C6XrWtA9vXuN8581R7XZ5pofhPUoC+jxkosyWViC56jRQwvtCpm+oqzzCle1AIQjcjIJjVFuBbUBhNXaDGR+TfotEFB4fCo+AOwasIkoguEobGa7XeIV/02bC+shibPtPazR/4irc4TYQKrJDUN6wMv0TYhs4MLN/kOYnbaZ5mpklP2qZVBMUFV/No+lGg4kbO5SQCXP1yio1G/Qm/SXwgE2S8Fgcfeu8qk/h6S0zj/LsgQVClGCfe4bWKJE/ESfcc9LJEBW9EFrZwzg25ZoHecIWvoVTQCqUUnmIRssWv60G9iB99o1aepm9QTlk5WvdlUO4iYyxLtr2Yic1IWfdz4zF2wq X-MS-Exchange-AntiSpam-MessageData: kkDyzFrQzBjY+guYAg4zgvvRylkE0vKc1mATLxy3dBymRnT7VBVdHFzHop7yD/KrEHsxKUW0GhSQsUF77VClAxJ9RKQcjPIYyJIwq/LVJ6Mml+5Ffe1Dv9I1Nz594H631Fg1zCwwiRBIE/6bbMYB6w== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc252b8e-6a87-496d-344d-08d7e229bc8e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2020 17:15:18.3585 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OIUdVt6jDDUuv2HSn4+paFdpISW3UvpAuv4bVvLG+K22lfyioNQyilX0rNLAaym9Lw+0NJYKYdMHCH0PeRvs6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3198 Subject: [dpdk-dev] [PATCH] net/mlx5: fix location of assert function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The asserts makes sure that 'i' doesn't exceed the exepcted value. This to prevent an out of bound access to dbr_bitmap. The current location of the assert protects the assignment of dbr_bitmap, but not the access to it. Moved the assert to the correct place, to protect both cases. Also, used an existing define for the assert. Fixes: 21cae858 ("net/mlx5: allocate door-bells via DevX") Cc: stable@dpdk.org Signed-off-by: Asaf Penso Reviewed-by: Dekel Peled Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index f8b134c..df12a3b 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1989,8 +1989,8 @@ struct mlx5_flow_id_pool * i++) ; /* Empty. */ /* Find the first clear bit. */ + MLX5_ASSERT(i < MLX5_DBR_BITMAP_SIZE); j = rte_bsf64(~page->dbr_bitmap[i]); - MLX5_ASSERT(i < (MLX5_DBR_PER_PAGE / 64)); page->dbr_bitmap[i] |= (1 << j); page->dbr_count++; *dbr_page = page; -- 1.8.3.1