From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 3588DC4741F for ; Mon, 28 Sep 2020 07:38:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2B8B22207 for ; Mon, 28 Sep 2020 07:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601278723; bh=PiD3Zi2tMnTXFm/5mYePwExWd1LeAD2rg1tycJRJy8A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=wUTqaxoII9hkUzooEp6uActK/0Ry/ZqUiG5W/bVerCVoXJtDIuR0snCTkl7El+Y3a oUOyKm1jhhdGzx6dvmqiSQbTWVH8GSoShVxBPHdaLJo/elX6F1uh21P1uQBIkxzMJS Ye/BGhcC12h3dtP1EfkNx3ZhZFdGPHBJ8422mSRk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbgI1Hil (ORCPT ); Mon, 28 Sep 2020 03:38:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:50998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726522AbgI1Hil (ORCPT ); Mon, 28 Sep 2020 03:38:41 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 644DA2080C; Mon, 28 Sep 2020 07:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601278721; bh=PiD3Zi2tMnTXFm/5mYePwExWd1LeAD2rg1tycJRJy8A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BLUuRRdYlgv1HjvaaH2htdGbx5Bkl60fVmhbTcrOX6sOLvndDvbm0fw3PgNwkferg UOOMGYW8rtPyBaffoLHpeMihopGuiddXCmJR7XjtGUHvl+sOMSiAHp9kl9SQoqOpgE eUUACCvUblza6iT3r1ScdZiQkJQGnPH3OI2Mx5+4= Date: Mon, 28 Sep 2020 10:38:36 +0300 From: Leon Romanovsky To: "Gustavo A. R. Silva" Cc: Saeed Mahameed , "David S. Miller" , Jakub Kicinski , Roi Dayan , Vlad Buslov , Ariel Levkovich , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] net/mlx5e: Fix potential null pointer dereference Message-ID: <20200928073836.GA3094@unreal> References: <20200925164913.GA18472@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200925164913.GA18472@embeddedor> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Sep 25, 2020 at 11:49:13AM -0500, Gustavo A. R. Silva wrote: > Calls to kzalloc() and kvzalloc() should be null-checked > in order to avoid any potential failures. In this case, > a potential null pointer dereference. > > Fix this by adding null checks for _parse_attr_ and _flow_ > right after allocation. > > Addresses-Coverity-ID: 1497154 ("Dereference before null check") > Fixes: c620b772152b ("net/mlx5: Refactor tc flow attributes structure") > Signed-off-by: Gustavo A. R. Silva > --- > drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky