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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80C3FC4332F for ; Tue, 22 Nov 2022 11:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233148AbiKVLVH (ORCPT ); Tue, 22 Nov 2022 06:21:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbiKVLUe (ORCPT ); Tue, 22 Nov 2022 06:20:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD74756D5F; Tue, 22 Nov 2022 03:16:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 928B4B81A19; Tue, 22 Nov 2022 11:16:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAD58C433C1; Tue, 22 Nov 2022 11:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669115775; bh=RWVuynQJHu6UtzfhI2bzUBNkk6dsjJgeNdwxgSTyLTA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lWle+BsPZDh9ljE/DC0N3F6yPpoFQ3SgUM8PY2pWl76Yrwu4JlGEfe2YKW3vvdPCJ Oq3glimLyPLX+dl3nC6Pj0ynuZaQyKVdhTXcRGkJ1kR9AMlJq7KCZtPDRFh0NfFF8R 1CZJHv0Sp/ROzpDYl5mMPrYV356CE7bPSkyHNQ4/C46T9Gu5uHeE5KGI0y5+zeTo16 Vnkg4y+9SxM3Ge4cwCU64upbMvPVd5nWk5nZGy4xYRjAwYMh13jWniXUCmUu5Q3VVd mWJBrBHGoxRvYKg8eQXO7TCv4yTYbfdtApwjPApFS0+HSRFXt1JO+ueYySqnDk5twK uC6HRb6aW5a+g== Date: Tue, 22 Nov 2022 13:16:11 +0200 From: Leon Romanovsky To: Denis Arefev Cc: Simon Horman , Jakub Kicinski , "David S. Miller" , oss-drivers@netronome.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, trufanov@swemel.ru, vfh@swemel.ru Subject: Re: [PATCH net v3] nfp: flower: Added pointer check and continue Message-ID: References: <20221118080317.119749-1-arefev@swemel.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221118080317.119749-1-arefev@swemel.ru> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Nov 18, 2022 at 11:03:17AM +0300, Denis Arefev wrote: > Return value of a function 'kmalloc_array' is dereferenced at > lag_conf.c:347 without checking for null, > but it is usually checked for this function. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > Fixes: bb9a8d031140 ("nfp: flower: monitor and offload LAG groups") > Signed-off-by: Denis Arefev > --- > drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) <...> > acti_netdevs = kmalloc_array(entry->slave_cnt, > sizeof(*acti_netdevs), GFP_KERNEL); > + if (!acti_netdevs) { > + schedule_delayed_work(&lag->work, NFP_FL_LAG_DELAY); > + continue; It is usually not good idea to continue after memory allocation fails. So or add __GFP_NOWARN with a comment why it is safe to continue or bail out from this loop. Thanks > + } > > /* Include sanity check in the loop. It may be that a bond has > * changed between processing the last notification and the > -- > 2.25.1 >