From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933077AbcIBRMU (ORCPT ); Fri, 2 Sep 2016 13:12:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55896 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932236AbcIBRMS (ORCPT ); Fri, 2 Sep 2016 13:12:18 -0400 Subject: Re: [PATCH 1/2] IB/hfi1: Fix a parameter of find_first_bit. To: Christophe JAILLET , mike.marciniszyn@intel.com, dennis.dalessandro@intel.com, sean.hefty@intel.com, hal.rosenstock@gmail.com References: <1472186949-9025-1-git-send-email-christophe.jaillet@wanadoo.fr> Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Kernel Janitors From: Doug Ledford Message-ID: Date: Fri, 2 Sep 2016 13:11:53 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KLEWhGxjdjrKsD5KCLmxXSssAdNdvPeW3" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 02 Sep 2016 17:12:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KLEWhGxjdjrKsD5KCLmxXSssAdNdvPeW3 Content-Type: multipart/mixed; boundary="dHKWclj7tECPWWun7TaqpQWrpGqo1Fd8G"; protected-headers="v1" From: Doug Ledford To: Christophe JAILLET , mike.marciniszyn@intel.com, dennis.dalessandro@intel.com, sean.hefty@intel.com, hal.rosenstock@gmail.com Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Kernel Janitors Message-ID: Subject: Re: [PATCH 1/2] IB/hfi1: Fix a parameter of find_first_bit. References: <1472186949-9025-1-git-send-email-christophe.jaillet@wanadoo.fr> In-Reply-To: --dHKWclj7tECPWWun7TaqpQWrpGqo1Fd8G Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 8/27/2016 1:25 AM, Christophe JAILLET wrote: > Le 26/08/2016 =C3=A0 15:35, Doug Ledford a =C3=A9crit : >> On 8/26/2016 12:49 AM, Christophe JAILLET wrote: >>> The 2nd parameter of 'find_first_bit' is the number of bits to search= =2E >>> In this case, we are passing 'sizeof(unsigned long)' which is likely = to >>> be 4 or 8. >> If the size can be 4 or 8, then using 64 universally is not correct. >> Why not use sizeof() * 8 (or << 3)? > I agree with you... >=20 > BTW, the log message is wrong. 'port_mask' is a u64. (not an unsigned > long). So the sizeof should always be 8. > (cut and paste error from another patch, sorry) Log message modified, then patch modified to use sizeof() * 8, result applied. Thanks. >> >>> It is likely that the number of bits of 'port_mask' was expected >>> here. This >>> variable is a 'u64', so use 64 instead. >>> >>> It has been spotted by the following coccinelle script: >>> @@ >>> expression ret, x; >>> >>> @@ >>> * ret =3D \(find_first_bit \| find_first_zero_bit\) (x, sizeof(...))= ; >>> >>> Signed-off-by: Christophe JAILLET >>> >>> --- >>> Not sure that using 64 directly is the best option. >>> Maybe '8 * sizeof(port_mask)' as used in the same file for >>> 'for_each_set_bit' would be better >>> --- > ... as noted here >=20 > Would you like a v2 patch or, will you update it by yourself? >=20 > Best regards, > CJ >=20 > --- > L'absence de virus dans ce courrier =C3=A9lectronique a =C3=A9t=C3=A9 v= =C3=A9rifi=C3=A9e par le > logiciel antivirus Avast. > https://www.avast.com/antivirus >=20 --=20 Doug Ledford GPG Key ID: 0E572FDD --dHKWclj7tECPWWun7TaqpQWrpGqo1Fd8G-- --KLEWhGxjdjrKsD5KCLmxXSssAdNdvPeW3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJXybLaAAoJELgmozMOVy/dPbQP/ArNz/8JhRQc5j738o3xpHk5 Pvh6fxLNBOGrtC+1az2OPe1NLulA9NCKuamWFXcT7htvZxQrIJjGKKthBRe51UVm ubxio0zh0FnWENbkNDbEO50gimaOq5CveUalzLtr3AhmzwBUtDWXdHVWeI8YL3Xe Tk7vsi0fpokpbsdSKxj00m1SlC6uSUwG7UrsMNveELeJVKX9nEF/0RyoBKmNMSOG IML8WjprekpUXmhfJHi20UYp/xpAC3rwmd82Cgudk18NThbDao5FOQrsnWwWDWoK eHUjK5z5PauHknwslXv8uy2n8A/mKyHrzdBKaaI18g1bqN9BuBtNea8wI0Fm6HnG PDJkiiP9qiQsGFnoyqEmQWv6c8hg3B+0h7NvclbTtIjOm5XOqaJfQZnws0xLbutt QJSJsEr+5yhDM+NJooo0qZFqcm8RHUKV+C/xTvyJWWWQ+13bgNG+ky10jG2sByTU RRxDQnWhjmVM2LQr2uquunSX0v57NNw4rDhWZiL4uhDy5WnbtGu23HbPxEUZ8WIi oj8dXP91or469glRol/XeLE08jcHDcBk+sePjxXp9DUIjmVYNLnslDmR9uH0Tiw+ 4c/vCDmJezpr1htdapouBjhZcOsOGcbWBSvgHMeU78FBwl86zf5d+gnVwPevNZNa yjsoL1UVafGfr0fMY4aI =NO9v -----END PGP SIGNATURE----- --KLEWhGxjdjrKsD5KCLmxXSssAdNdvPeW3--