Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp489781rdb; Fri, 17 Nov 2023 04:57:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFV2eST85Dq2TIn096UrtSFriCVjX8Oyc9iplllWwdiAgBt0XmjZBOzDtZwJCu+IEinvNFl X-Received: by 2002:a05:6a00:2d0f:b0:6c3:6b26:bba4 with SMTP id fa15-20020a056a002d0f00b006c36b26bba4mr22941863pfb.33.1700225842987; Fri, 17 Nov 2023 04:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700225842; cv=none; d=google.com; s=arc-20160816; b=M330ftG+5Wpi2QqC+EfmawQUKb8TfhRSvjh63SQuJxyUrbGRVPiS1/d6r/qgGXXYtJ KmXHaRdEbBt3joCne9hqJO95Qgk01dLf9s/dily+TLJtQXqsrzqRKJ+5SWmuqdmbLuLI VGh+G0NvAjTJp0IGReU6+RudWn5cI7WTTLd/n0RJefaN5bF3ft2MzhJCUHNn7x6a73lv DBMkypW3h6eyL8Bqvkz41EE1JDcohb8SzA7IPLxbQeFi0OpfHcioUYJ9EVkkwGzcYtFk Iy1jZId/roo26TcAVLe+M1kvFSfj9+mfQC3IlxUHBdpBSPIDubW+IBCcl0h7hv5sNZbN LGaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=yZD/Sn1R2SVTne1HGGZ4hKTypVy6dTpTjai+r/elyT4=; fh=P/RQfKjOhNs7ABLLXVaJjAQ7olxvoGqD6PM9QdH06Wo=; b=naiI4C1ADju1BZBU4WZ116+bQZdSOPPzhhu104y/ekRvY+XNgmktAMS6+fBvOMkbHg 6Q//osUREyh0/gjpvFrnB611pqRtpHik1JDjEW58+mheBM7FmZz8HBrMDxClPnacmy5e zGhSHrfDTR28t+iRh/UNa6SSN4Oyp2Rdi7cf/zZISUJOyC9c/QlSpNbx7iDO03GuPj8Y 4PCKO36gLmPJkdyDw/z9Fh1refkTgA+QPYqmK4LR31K+UkB80H8ycHNIdM3lxEr5whLC efRdI7ASYwzDuCuAxdCWrEOgqAMkLGoBhy5nN4PNUR4sJKhZHRAFx2sxsDFoboVJmhDU rKFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=voctcqkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id q13-20020a056a00150d00b006b7582b294dsi1936992pfu.129.2023.11.17.04.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 04:57:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=voctcqkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 77A58832EF43; Fri, 17 Nov 2023 04:57:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbjKQM5M (ORCPT + 99 others); Fri, 17 Nov 2023 07:57:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbjKQM5L (ORCPT ); Fri, 17 Nov 2023 07:57:11 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05820D5F for ; Fri, 17 Nov 2023 04:57:06 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1700225821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=yZD/Sn1R2SVTne1HGGZ4hKTypVy6dTpTjai+r/elyT4=; b=voctcqkI8M3/osfELiL5uRL72hNMig0TDFR1ZR7+xmlj6OJObqtE8LUvi3Qzglfs5uHBl8 LXIe0hTkwSfX6uE4GncVWtF+JtUvwhSrxrJat6y1cVbAtjpajoljkFtpQ3Q4LBOQqC1y8D fGrIKupsOn6duLlxjhLty6v8vm6ONGI= To: Louis Peens Cc: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , oss-drivers@corigine.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] nfp: flower: Added pointer check and continue. Date: Fri, 17 Nov 2023 15:57:01 +0300 Message-Id: <20231117125701.58927-1-arefev@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 04:57:20 -0800 (PST) Return value of a function 'kmalloc_array' is dereferenced at lag_conf.c without checking for null, but it is usually checked for this function. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev --- drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c index 88d6d992e7d0..8cc6cce73283 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/lag_conf.c @@ -339,6 +339,11 @@ static void nfp_fl_lag_do_work(struct work_struct *work) 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; + } + /* Include sanity check in the loop. It may be that a bond has * changed between processing the last notification and the * work queue triggering. If the number of slaves has changed -- 2.25.1