Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2008896pxk; Tue, 1 Sep 2020 13:15:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO36QLB3v97wAtOGxfWIh9wDyVaROJwTU/7tLN1ZBtMdoRvqYs4c4hw3o9xbR7GHymKFC3 X-Received: by 2002:a17:906:e2d5:: with SMTP id gr21mr3434419ejb.438.1598991338469; Tue, 01 Sep 2020 13:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598991338; cv=none; d=google.com; s=arc-20160816; b=V1OLQF3uDrcAsPyyU04GCP21BB+DL7zxlt58HnczoxUegkhTA5OtAo4KtcCuWonlS+ hU4YQv7SkKxhV06tnc6lAXJ3zbD2MsWbwfkSqqHCyfrKlLyEuWTr+1da6A1KRcVsdw7X yl1c/i8NeCJA1KM+BXnxP2SATpvto76hbUiyn5kuCcyy/njnyOA7dcKPwfvijdhETvbu X5VvZqq1DDCOwiv788PvwLVPIsCBuU62pETls17+SZTdNAEOXuOKSQ+uec/Bgq4ugJFe HNu6rV7xTsj62KJt8FX91wRyeAOU3W6M66Rxlvcz75AXKdTUYPG9UJirfK3vORAvTOFy xfow== 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 :references:in-reply-to:from:subject:cc:to:message-id:date; bh=G/uA6hRjtDI8fwQ3ZLTnCOlF+L4VEtGRmxTL5uCjeAM=; b=isp2SJnkFmIOmF8r5/Hw+lghyXmwkSY23V0C10ermpzfXE1Jn8vOg8b3EbNSWPxllT xkXvMo1ysStPHTLi5dKo4hWTQMEKDrnp7/Lw1H92DXoN8NHy/jzDlI27fPFGwfJ5vIKt rJ4Kxi60wmytiQFql/lCbOvqr7L8/VcE6qF9hAcCE7A6ghe3mQaFMDa0f5I9E3Fu8yD4 Hc8adAR3X3WLWvu0130V3zxjlZ8lp2TdOePjFXHkummFj4ma2ke/00HUvjRxnZPVXGJP lMvZf6gUrizpedYjdjAvQus9BfNMGRjEwsEyt0Scy3fI1UF3uk/FBwnyXNu6oVkcmKcz xbDg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si1534534edl.249.2020.09.01.13.15.14; Tue, 01 Sep 2020 13:15:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729185AbgIAUNz (ORCPT + 99 others); Tue, 1 Sep 2020 16:13:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbgIAUNz (ORCPT ); Tue, 1 Sep 2020 16:13:55 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C080FC061244; Tue, 1 Sep 2020 13:13:54 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 5EA0E1364C88D; Tue, 1 Sep 2020 12:57:07 -0700 (PDT) Date: Tue, 01 Sep 2020 13:13:53 -0700 (PDT) Message-Id: <20200901.131353.1215898622774184669.davem@davemloft.net> To: shung-hsi.yu@suse.com Cc: tariqt@nvidia.com, kuba@kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init() From: David Miller In-Reply-To: <20200831143709.GA12996@syu-laptop> References: <20200831143709.GA12996@syu-laptop> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [2620:137:e000::1:9]); Tue, 01 Sep 2020 12:57:07 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shung-Hsi Yu Date: Mon, 31 Aug 2020 22:37:09 +0800 > On machines with much memory (> 2 TByte) and log_mtts_per_seg == 0, a > max_order of 31 will be passed to mlx_buddy_init(), which results in > s = BITS_TO_LONGS(1 << 31) becoming a negative value, leading to > kvmalloc_array() failure when it is converted to size_t. > > mlx4_core 0000:b1:00.0: Failed to initialize memory region table, aborting > mlx4_core: probe of 0000:b1:00.0 failed with error -12 > > Fix this issue by changing the left shifting operand from a signed literal to > an unsigned one. > > Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters") > Signed-off-by: Shung-Hsi Yu Applied and queued up for -stable, thanks.