All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Kroening, Gary" <gary.kroening@hpe.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"Travis, Mike" <mike.travis@hpe.com>,
	"Banman, Andrew" <abanman@hpe.com>,
	"Sivanich, Dimitri" <dimitri.sivanich@hpe.com>,
	"Anderson, Russ" <russ.anderson@hpe.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] x86/platform/x86: Fix count of CHas on multi-pci-segment arches
Date: Tue, 13 Mar 2018 13:42:55 -0400	[thread overview]
Message-ID: <f452e41a-533f-60d5-2e19-9bdbcdc16396@linux.intel.com> (raw)
In-Reply-To: <55123ef5-3287-d4c9-4499-62140c598474@linux.intel.com>



On 3/13/2018 1:16 PM, Liang, Kan wrote:
> 
> 
> On 3/13/2018 11:58 AM, Andy Shevchenko wrote:
>> On Tue, Mar 13, 2018 at 3:42 AM, Liang, Kan 
>> <kan.liang@linux.intel.com> wrote:
>>
>>> +#define SKX_CAPID6             0x9c
>>> +#define SKX_CHA_BIT_WIDTH      28
>>> +
>>>   static int skx_count_chabox(void)
>>>   {
>>> +       struct pci_dev *dev = NULL;
>>> +       u32 val = 0;
>>>
>>
>>> +       dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2083, dev);
>>> +       if (!dev)
>>> +               return 0;
>>
>> Where is pci_dev_put()?
>>
>>>
>>> +       pci_read_config_dword(dev, SKX_CAPID6, &val);
>>> +       return bitmap_weight((unsigned long *)&val, SKX_CHA_BIT_WIDTH);
>>
>> UB is here.
>> Fix is simple, use unsigned long and drop this ugly casting.
>>

Just noticed that we have to do casting anyway.
pci_read_config_dword uses u32.
bitmap_weight uses unsigned long.

Thanks,
Kan

  reply	other threads:[~2018-03-13 17:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 20:33 [PATCH 1/1] x86/platform/x86: Fix count of CHas on multi-pci-segment arches Kroening, Gary
2018-03-13  1:42 ` Liang, Kan
2018-03-13  5:06   ` Kroening, Gary
2018-03-13 12:28     ` Liang, Kan
2018-03-13  5:24   ` Kroening, Gary
2018-03-13 15:58   ` Andy Shevchenko
2018-03-13 16:00     ` Andy Shevchenko
2018-03-13 17:15       ` Liang, Kan
2018-03-13 17:22         ` Andy Shevchenko
2018-03-13 17:28           ` Liang, Kan
2018-03-13 17:31             ` Andy Shevchenko
2018-03-13 17:16     ` Liang, Kan
2018-03-13 17:42       ` Liang, Kan [this message]
2018-03-13 17:46         ` Andy Shevchenko
2018-03-13 17:49           ` Andy Shevchenko
2018-03-13 17:50             ` Andy Shevchenko

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=f452e41a-533f-60d5-2e19-9bdbcdc16396@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=abanman@hpe.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dimitri.sivanich@hpe.com \
    --cc=gary.kroening@hpe.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.travis@hpe.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=russ.anderson@hpe.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.