linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Liang, Kan" <kan.liang@linux.intel.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 17:58:11 +0200	[thread overview]
Message-ID: <CAHp75VdYG+i+m12yotuUa2JwW4ndMMXTV0ZSs_qOS5EAw7=M4w@mail.gmail.com> (raw)
In-Reply-To: <9efcdfa1-9da3-f4de-749f-0950d20a5758@linux.intel.com>

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.

>  }

-- 
With Best Regards,
Andy Shevchenko

  parent reply	other threads:[~2018-03-13 15:58 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 [this message]
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
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='CAHp75VdYG+i+m12yotuUa2JwW4ndMMXTV0ZSs_qOS5EAw7=M4w@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=abanman@hpe.com \
    --cc=dimitri.sivanich@hpe.com \
    --cc=gary.kroening@hpe.com \
    --cc=hpa@zytor.com \
    --cc=kan.liang@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).