From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Doug Ledford <dledford@redhat.com>,
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 <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 1/2] IB/hfi1: Fix a parameter of find_first_bit.
Date: Sat, 27 Aug 2016 07:25:02 +0200 [thread overview]
Message-ID: <d3eea048-5c7e-a5e9-900b-fabf0f6e38c8@wanadoo.fr> (raw)
In-Reply-To: <cf61e699-9e2d-a594-64e6-43ea33b239d9@redhat.com>
Le 26/08/2016 à 15:35, Doug Ledford a écrit :
> On 8/26/2016 12:49 AM, Christophe JAILLET wrote:
>> The 2nd parameter of 'find_first_bit' is the number of bits to search.
>> 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...
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)
>
>> 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 = \(find_first_bit \| find_first_zero_bit\) (x, sizeof(...));
>>
>> Signed-off-by: Christophe JAILLET
>> <christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
>> ---
>> 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
Would you like a v2 patch or, will you update it by yourself?
Best regards,
CJ
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
next prev parent reply other threads:[~2016-08-27 5:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 4:49 Christophe JAILLET
2016-08-26 13:35 ` Doug Ledford
2016-08-26 18:01 ` Doug Ledford
2016-08-26 19:29 ` Leon Romanovsky
2016-08-26 19:34 ` Doug Ledford
2016-08-28 6:06 ` Leon Romanovsky
2016-09-02 14:39 ` Doug Ledford
2016-09-04 9:04 ` Leon Romanovsky
2016-08-27 5:25 ` Christophe JAILLET [this message]
2016-09-02 17:11 ` Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d3eea048-5c7e-a5e9-900b-fabf0f6e38c8@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=dennis.dalessandro@intel.com \
--cc=dledford@redhat.com \
--cc=hal.rosenstock@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@intel.com \
--cc=sean.hefty@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®