Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp509417pxb; Wed, 18 Aug 2021 07:27:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylO0jDgo4Kxlvyg0PZZSjzuQjYXqjYa7ZIYs3cM/HyHSVR2DfyprS04rMep9wKlS3lMlmQ X-Received: by 2002:a92:c60b:: with SMTP id p11mr6082738ilm.65.1629296834766; Wed, 18 Aug 2021 07:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629296834; cv=none; d=google.com; s=arc-20160816; b=BYRMrVWtEsIBTp37cn/VT12vu9tidVdEov/XwxXzW3Y+QWLaUd4iGIQl18iDyMuatm iYv+deVjQchBZQbiIVdvm1cQMYo0ABRrnU2tkKCFDFKZWlNjrfdDjz56FDgfNselcCJq 7EKm0UMzO6T8bxhheqTvkswGswgdEnPH/u02orvXY8rJrdkrgbHMurg0anZybpGEHZsP 9iO0is69xmWBJ8aAKii6JhLvsvL2SGgDkhgtarhaxBQf1mKDAZbXFhEzVt5fIJUp1Fb5 NT3rG0GyM9+BSQ8g5C5mYT7hS8vQsUeLVhvpunwKORrhJf85rsVwse0+8Kb0YRIRs1Mx YvRw== 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:from:dkim-signature; bh=DTwOa3CWESrtiaTREvgjdVFPvu/DaRcGwqeFgJ0bd/w=; b=o1vMVxsr5Ptl+KLNfFOuoeRd5cQZqaUpG44rrbLe35ViH2u8iisLhV7VRJj7xauS0H eCPViPJJhvoR6zecHO2VVbAMBk57r+9aziqdWQPHrovhmZvi/2u7/33JWJuiP2hQurR6 zrzNfQr9wNF13piOFVsUaCHt9KN9iw0Z4mHavBD24KQjmrzvoi5FGJT1zbdKtqvTm5JO Sy/R9fZ8CgVa3CakGk8BDwOR1HycEjn9EJkVt/lsy/HKnOaF/mFA5UK+ML0odbVf0Qa0 jwRbmN6nav+tmD8TKmSj9YuoKNKG5J52opUIvVqNDeY0Aj4ZQ839Ze+v1j9u1J6OVmjJ oHOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=wRxLVlKI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si1190ilq.55.2021.08.18.07.27.03; Wed, 18 Aug 2021 07:27:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=wRxLVlKI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238970AbhHRO0f (ORCPT + 99 others); Wed, 18 Aug 2021 10:26:35 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:51264 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238445AbhHRO0e (ORCPT ); Wed, 18 Aug 2021 10:26:34 -0400 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 6C04A3F09F; Wed, 18 Aug 2021 14:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1629296758; bh=DTwOa3CWESrtiaTREvgjdVFPvu/DaRcGwqeFgJ0bd/w=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=wRxLVlKI66AnEPnXtp3RyH+diZ7zXcUuwsiK070puzfLo3+jmY/sZLvi/QMx1D9l4 7osBIhWLx6VBGQWyAmffAlitNvNGMo02+XrX8myxZRqZCBZOGpN7mzDZRjr/KaxVk6 36ybNxMcWL6eF03a0agTApUqRg6KbLYJgq8rkwrN4dUEN6uaH4dtJQqYmZaJkMzzyO 5UZZZWt+vpbRPwP26RFrEtVbUYT3zNEXmOOT4tQVQ1NtKSYrSi0qoMgike2vW5G+pY gL6SUzO/ZC+MsB3CeiLC4YUpVju4eyT94+4bI5daHWP7Slf0z61Lu9CxxlvJ+g6X7o 1eyTRIiZhpFFw== From: Colin King To: Saeed Mahameed , Leon Romanovsky , "David S . Miller" , Jakub Kicinski , Vlad Buslov , Mark Bloch , Roi Dayan , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] net/mlx5: Bridge: Fix uninitialized variable err Date: Wed, 18 Aug 2021 15:25:58 +0100 Message-Id: <20210818142558.36722-1-colin.king@canonical.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King A recent change removed the assignment of err to the return from the call mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get, so now err is uninitialized. This is problematic in the switch statement where attr-id is SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS, there is now a possibility of err not being assigned and the function returning a garbage value in err. Fix this by initializing err to zero. Addresses-Coverity; ("Uninitialized scalar variable") Fixes: ff9b7521468b ("net/mlx5: Bridge, support LAG") Signed-off-by: Colin Ian King --- drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c index 0c38c2e319be..4bf860f621f7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c @@ -244,7 +244,7 @@ mlx5_esw_bridge_port_obj_attr_set(struct net_device *dev, struct netlink_ext_ack *extack = switchdev_notifier_info_to_extack(&port_attr_info->info); const struct switchdev_attr *attr = port_attr_info->attr; u16 vport_num, esw_owner_vhca_id; - int err; + int err = 0; if (!mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num, &esw_owner_vhca_id)) -- 2.32.0