Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp336881yba; Sat, 4 May 2019 03:30:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEgw0lfPox35CSqZiuxJGZqhF63yNWRSvsdAH/aJ9xPqM5NmSVVVjcKeONyKgp1zcgGk+5 X-Received: by 2002:a62:1f1b:: with SMTP id f27mr18894751pff.89.1556965831603; Sat, 04 May 2019 03:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556965831; cv=none; d=google.com; s=arc-20160816; b=n/orqnjQvN/iSFsIF55xAvMMBpQPGRI1AdH/2hSea47MfOAjZnJasx5HFiZ4pUxE3y J890ILRu2n4nxBJeUgPuqWDEvEgHhsiSunHrvFhnc0TZjxaYO1eFN64yt5ZsPSmBZEMr 7Okb+kKc0KEWbIIsKOgzRIk/EEf0DQVuG0m9qgedcr0043E1xQF7K5G6HLztGIyCTvlp /UwkhpSGc6ef2JJXG6/+0E8+21npxBOZ9mdIUHwsSrrVBZzT9peqJykwDdLskfooeLFs Yl6KViplGuFk/l9R7hpI5lelqxvv49pbPqVuBYw+93bQzQL8wZzf9ydbtlUz37gMahIm DyRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FkLKj6vRQQM5T2xoluoXnaPIO0tbb8i0SnHShSoyW1o=; b=q9AlqERhDGBS379o3fMZXMrzb8c5DxTJTuRrLfnxFeOlQUHs1F+PNZUtca9JTNhZsc NiJDmxOoGQ/V0reaTZM9b3wvLYr3++r8/uEbcXrYv5WINcPvN5wh5wTYRMu5VWuFbJOR nHUOM0e6CPPPbXuKXYoj4iY9PioulnK0O+eKn8SAWQ8ceMdrKnNnYt5K3sT4GUeTz11o Ey+/lngI6XZQEVUV3VS4wNSSPyl0QAHDoV54dkZNGtP5SHKTW0RZExbsqRDq02P+vDDt RLnRNl+QcaTRm+H70nc5JiGHPpJxQwJRWgJE8DofBaWx1xashp1ljK9ODOh3idXgmcXU OH2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F5gHUcpb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23si6441869pfm.186.2019.05.04.03.30.16; Sat, 04 May 2019 03:30:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F5gHUcpb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728165AbfEDK11 (ORCPT + 99 others); Sat, 4 May 2019 06:27:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:37526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728138AbfEDK1X (ORCPT ); Sat, 4 May 2019 06:27:23 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 5E40F2085A; Sat, 4 May 2019 10:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556965642; bh=B8JsXVskxkafTJQUaOveFYwhPevrBxRFNw+nTHpxvTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5gHUcpbLvl/meZX9PvBqg60SxNdOE14ujEfbJlf3w23VV4CW/KUkNBedBavB6ecO tTiMEjvMLLxD5GkeLH9i5h/QZ8aH2UQotVHv+IUEAU3yNrYt18YOP1G64uEGSrzYG+ mWBPcX7eLOP1QSYRFx5vS0mRg7ZtQZu3LJ45IFoM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Michael Chan , "David S. Miller" Subject: [PATCH 4.19 17/23] bnxt_en: Fix uninitialized variable usage in bnxt_rx_pkt(). Date: Sat, 4 May 2019 12:25:19 +0200 Message-Id: <20190504102452.093390037@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190504102451.512405835@linuxfoundation.org> References: <20190504102451.512405835@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Chan [ Upstream commit 0b397b17a4120cb80f7bf89eb30587b3dd9b0d1d ] In bnxt_rx_pkt(), if the driver encounters BD errors, it will recycle the buffers and jump to the end where the uninitailized variable "len" is referenced. Fix it by adding a new jump label that will skip the length update. This is the most correct fix since the length may not be valid when we get this type of error. Fixes: 6a8788f25625 ("bnxt_en: add support for software dynamic interrupt moderation") Reported-by: Nathan Chancellor Cc: Nathan Chancellor Signed-off-by: Michael Chan Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1584,7 +1584,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, netdev_warn(bp->dev, "RX buffer error %x\n", rx_err); bnxt_sched_reset(bp, rxr); } - goto next_rx; + goto next_rx_no_len; } len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT; @@ -1665,12 +1665,13 @@ static int bnxt_rx_pkt(struct bnxt *bp, rc = 1; next_rx: - rxr->rx_prod = NEXT_RX(prod); - rxr->rx_next_cons = NEXT_RX(cons); - cpr->rx_packets += 1; cpr->rx_bytes += len; +next_rx_no_len: + rxr->rx_prod = NEXT_RX(prod); + rxr->rx_next_cons = NEXT_RX(cons); + next_rx_no_prod_no_len: *raw_cons = tmp_raw_cons;