Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp844410imu; Tue, 11 Dec 2018 08:24:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/VUGeyLEDCnrGTOVfd45Ej9O3eHeF4f27LdUsXAi2N39SC2mABQq/Wf5+mqUlm8HzEAvGqy X-Received: by 2002:a63:e302:: with SMTP id f2mr15373596pgh.320.1544545487659; Tue, 11 Dec 2018 08:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544545487; cv=none; d=google.com; s=arc-20160816; b=vDqFh8Nt9AmKExx97pd/jiBN3ZHV7g0w+5la8iWUpKor48JyS2e1QIV+Y9C9yVT7DH 4kRDWprWsV3RXMImyLjeZI47kg5pz+jk1y9Vv414OnDLwraOznxRu+LLzV4jKv5ObFCK n8PMRjbbDZm/CkC6cj5+uuUq7l/YFVTc3YKdTlYyzRMGdagg0fWt1Ln/nQ4G+iRtfKQK AsRuZUsuDscun6bvEJ0pfDiFNFfFSXtrCT21AO1/gGV4IVmd/6jQF8cC+uK9tWqdbUHd 1xW+8a8joiH7STDBOJO4APb/2z6yc1gBNcHjykPR0shjfRBp+i5oUM9EviUmxGK1a/oN SU3A== 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=iM/bUxjvuA/naLK+OBCkjgTMyd6jSoosxGNSiBx55iQ=; b=FztU8kBJgmkejx+5Xyhnm/ma04ObEWWhfI6JSp61jDv9YcMjj6lYV552L78KPso653 EI0UK8HC7KENHEO3lG40KVIrLIrOzHEXPcRuuLGXXm8TsOw7UpL1bjJN0M/fhJjUJLf1 fz2Z5XnOZXfkUb1f6IQf2ptl25whdVRPEr0MhrpmHg2+XDlanlFzVW7fp5OqTa5E4uYo hFLZTltN1WLD8Sb+yTnHxB5pfdmy9tb+W9Y1r3xbUKBOqWPZTe5957OhraRnQDgHBnhZ ZCF/kfA+WPhYNtUqZsuDzg0a8gn5vn+S0ono0ceSwDgc5yPX68X5XHnOVr0cU6cjXLsK 7EeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nnZSDUMx; 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 3si13294742plo.102.2018.12.11.08.24.33; Tue, 11 Dec 2018 08:24:47 -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=nnZSDUMx; 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 S1727635AbeLKPnt (ORCPT + 99 others); Tue, 11 Dec 2018 10:43:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:60348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727622AbeLKPnq (ORCPT ); Tue, 11 Dec 2018 10:43:46 -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 0AB1920672; Tue, 11 Dec 2018 15:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543025; bh=sAPiXTXShBb6zsb5/SvdDf5j0AqQJvA11mzD7REyVRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnZSDUMxr/9j4dxQKD6fdPzeYXkBQBb6D8PAxMIb84dZYLON1dJZ/Mpx7cPb7iVNL nWivl/mtJvgJVD5SnOS/w5XQyQScxbJbgoQjmDXDV1zD7Ma7/uk5GUltfS5dvHg+iv WZncpjDBTWwOpmKm2xAAdJfVckYtOxrGK3mkEoO4= 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 3.18 37/54] net/mlx4: Fix UBSAN warning of signed integer overflow Date: Tue, 11 Dec 2018 16:41:25 +0100 Message-Id: <20181211151548.178947254@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151546.010073210@linuxfoundation.org> References: <20181211151546.010073210@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 3.18-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 de10dbb2e6ed..4f63915f14be 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h @@ -516,8 +516,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