Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752898AbdLERBZ (ORCPT ); Tue, 5 Dec 2017 12:01:25 -0500 Received: from ale.deltatee.com ([207.54.116.67]:51454 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752481AbdLERBY (ORCPT ); Tue, 5 Dec 2017 12:01:24 -0500 To: Jon Mason , Serge Semin Cc: Dave Jiang , "Hubbe, Allen" , "S-k, Shyam-sundar" , "Yu, Xiangliang" , Gary R Hook , Sergey.Semin@t-platforms.ru, linux-ntb , linux-kernel References: <20171203191736.3399-1-fancer.lancer@gmail.com> <20171203191736.3399-4-fancer.lancer@gmail.com> From: Logan Gunthorpe Message-ID: <8859c11b-6c6b-3780-c13a-2ae0affd7033@deltatee.com> Date: Tue, 5 Dec 2017 10:01:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Sergey.Semin@t-platforms.ru, gary.hook@amd.com, Xiangliang.Yu@amd.com, Shyam-sundar.S-k@amd.com, Allen.Hubbe@emc.com, dave.jiang@intel.com, fancer.lancer@gmail.com, jdmason@kudzu.us X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v2 03/15] NTB: Fix UB/bug in ntb_mw_get_align() X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 894 Lines: 21 On 05/12/17 09:52 AM, Jon Mason wrote: > On Sun, Dec 3, 2017 at 2:17 PM, Serge Semin wrote: >> Simple (1 << pidx) operation causes undefined behaviour when >> pidx >= 32. It must be casted to u64 to match the actual return >> value of ntb_link_is_up() method, so to have all the possible >> peer indexes covered and to get rid of undefined behaviour. >> Additionally there are special macros in "linux/bitops.h" to perform >> the bit-set-shift operations, so it's recommended to have them used >> for proper bit setting. > > This looks good to me, but also seems like a bug fix. Please comment > on if this is not noticed. It would be a bug on any system that has more than 32 partitions which is run on a 32 bit machine (or 64 partitions on a 64bit machine). Such a system is theoretical for the foreseeable future. But it would be good to fix it now. Logan