Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp919134imu; Tue, 11 Dec 2018 09:32:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/V57u3+jmtbFhWZ5QEg7z1tcy6ujQLZkIgyHhfySUyBTSQ28BkicvVokibU2R55eYRMV+uq X-Received: by 2002:a63:a452:: with SMTP id c18mr15644214pgp.204.1544549577781; Tue, 11 Dec 2018 09:32:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544549577; cv=none; d=google.com; s=arc-20160816; b=aiwxm935kd4X7FOOyfNnB0voKi0p9ngFA/VmLUR922NqwltgZMgIphlI6N0bN/Yxb2 CJ/HKqFIccs+Qs30ffH/yZgGmNJFqkcquLKJRua/6ONZiJiSORKJMzNpQ2tlBjrT/hDQ 2Sn5GuxEShKY6uXxNv3YWiyXc2haGdYfSyCgob5z59fKFsMlCJH/jbJHKCd65FxWRhpG QAx1HiyxUWkJy/NgI0VTdxm1Bc1H0DDLVBOi47XRbbiq66kOr+FbU0kNnx405QN7xI3Z WaF19l2kD6cIB3oVY+akiLebxXD/nX7/hv00Lu5Uv3rGvcR6kiBbKHSIaxcHXgwtecPc dOgQ== 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=nFegdn6sWyXmlwardL7/iLX6wTUFwHEXg7QqFrdXP2g=; b=jdV2fd/pRy6VY0PxUJxV9dHnbMnQCbjSLeogUDlHzCUYPEEIVMGb9haYkH3PsAJ6vX K3cqbPxJ5rTf2QRHgdXSjpOTbADdu/EysO8epuCwp/fV0md+sCBQ1CoMz1Vm1iS55sCg yZi3as4Zd0nP+HVDoZCL6fWEL+ixZ77MEIkqgIB21GoLjg42aJ2UPQogD+x2A13UZpE+ HeQf4n/Bm9BF3GnvlNnVOaIAQV6q7EP7w9rHHg2Z8pHnxhMh2f/quOOdxd5vy3nwNVtJ CIvTYCo5jmHzCqNu28+TrDcoKMyVfJAifJskhZqdjhuiuPvj71doTTeA9xsyd6Xy44HU zBZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rQepz3oG; 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 o184si11765701pgo.591.2018.12.11.09.32.42; Tue, 11 Dec 2018 09:32:57 -0800 (PST) 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=rQepz3oG; 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 S1728517AbeLKPrT (ORCPT + 99 others); Tue, 11 Dec 2018 10:47:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:35776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727835AbeLKPrS (ORCPT ); Tue, 11 Dec 2018 10:47:18 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 7CE682146D; Tue, 11 Dec 2018 15:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543238; bh=udgaIKOM/ryxsNJgBuFb7iU//y+YUB/CkfPswMUNaY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQepz3oGPuHSgq10dGEwuXaeOJnIZVU+LKashn2BnPTk4WCljnQiSsJeATr5O4/CL Z6JTe6XcRCnIOnqnPUuLRI3di11Oeg2YW1VoGMnL2AHpGnVDwwadVVV53E560lJpqH XUNOgjyQXglWGcLfIA+MVmyD3Eo+ACAa/gcr8+Y8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Tariq Toukan , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 66/91] net/mlx4: Fix UBSAN warning of signed integer overflow Date: Tue, 11 Dec 2018 16:41:25 +0100 Message-Id: <20181211151611.631008994@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151606.026852373@linuxfoundation.org> References: <20181211151606.026852373@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit a463146e67c848cbab5ce706d6528281b7cded08 ] UBSAN: Undefined behavior in drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:626:29 signed integer overflow: 1802201963 + 1802201963 cannot be represented in type 'int' The union of res_reserved and res_port_rsvd[MLX4_MAX_PORTS] monitors granting of reserved resources. The grant operation is calculated and protected, thus both members of the union cannot be negative. Changed type of res_reserved and of res_port_rsvd[MLX4_MAX_PORTS] from signed int to unsigned int, allowing large value. Fixes: 5a0d0a6161ae ("mlx4: Structures and init/teardown for VF resource quotas") Signed-off-by: Aya Levin Signed-off-by: Tariq Toukan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx4/mlx4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index f5fdbd53d052..db40387ffaf6 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h @@ -537,8 +537,8 @@ struct slave_list { struct resource_allocator { spinlock_t alloc_lock; /* protect quotas */ union { - int res_reserved; - int res_port_rsvd[MLX4_MAX_PORTS]; + unsigned int res_reserved; + unsigned int res_port_rsvd[MLX4_MAX_PORTS]; }; union { int res_free; -- 2.19.1