[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8431ed30-b9c7-e91b-e6e6-2afd03dde360@huawei.com>
Date: Thu, 7 May 2020 12:10:27 +0800
From: Samuel Zou <zou_wei@...wei.com>
To: Joe Perches <joe@...ches.com>,
Luciano Coelho <luciano.coelho@...el.com>,
<johannes.berg@...el.com>, <emmanuel.grumbach@...el.com>,
<linuxwifi@...el.com>, <kvalo@...eaurora.org>,
<davem@...emloft.net>, "Julia Lawall" <julia.lawall@...6.fr>
CC: <linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, cocci <cocci@...teme.lip6.fr>
Subject: Re: [PATCH -next] iwlwifi: pcie: Use bitwise instead of arithmetic
operator for flags
Both of you are right.
I neglected, and this patch is wrong.
Thanks.
On 2020/5/6 23:15, Joe Perches wrote:
> On Wed, 2020-05-06 at 16:51 +0300, Luciano Coelho wrote:
>> On Tue, 2020-05-05 at 20:19 -0700, Joe Perches wrote:
>>> On Wed, 2020-05-06 at 11:07 +0800, Samuel Zou wrote:
>>>> This silences the following coccinelle warning:
>>>>
>>>> "WARNING: sum of probable bitmasks, consider |"
>>>
>>> I suggest instead ignoring bad and irrelevant warnings.
>>>
>>> PREFIX_LEN is 32 not 0x20 or BIT(5)
>>> PCI_DUMP_SIZE is 352
>>>
>>>> diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
>>> []
>>>> @@ -109,9 +109,9 @@ void iwl_trans_pcie_dump_regs(struct iwl_trans *trans)
>>>>
>>>> /* Alloc a max size buffer */
>>>> alloc_size = PCI_ERR_ROOT_ERR_SRC + 4 + PREFIX_LEN;
>>>> - alloc_size = max_t(u32, alloc_size, PCI_DUMP_SIZE + PREFIX_LEN);
>>>> - alloc_size = max_t(u32, alloc_size, PCI_MEM_DUMP_SIZE + PREFIX_LEN);
>>>> - alloc_size = max_t(u32, alloc_size, PCI_PARENT_DUMP_SIZE + PREFIX_LEN);
>>>> + alloc_size = max_t(u32, alloc_size, PCI_DUMP_SIZE | PREFIX_LEN);
>>>> + alloc_size = max_t(u32, alloc_size, PCI_MEM_DUMP_SIZE | PREFIX_LEN);
>>>> + alloc_size = max_t(u32, alloc_size, PCI_PARENT_DUMP_SIZE | PREFIX_LEN);
>>>>
>>>> buf = kmalloc(alloc_size, GFP_ATOMIC);
>>>> if (!buf)
>>
>> Yeah, those macros are clearly not bitmasks. I'm dropping this patch.
>
> Can the cocci script that generated this warning
>
> scripts/coccinelle/misc/orplus.cocci
>
> be dropped or improved to validate the likelihood that
> the defines or constants used are more likely than
> not are bit values?
>
> Maybe these should be defined as hex or BIT or BIT_ULL
> or GENMASK or the like?
>
>
> Right now it seems it just tests for two constants.
>
>
>
> .
>
Powered by blists - more mailing lists