public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] PCI: mobiveil: integer overflow in IB_WIN_SIZE
Date: Mon, 09 Jul 2018 11:42:41 +0000	[thread overview]
Message-ID: <20180709114241.GA1798@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <CAFZiPx1w_st+TY+EKm6nxvJ=S_ZJzUY2No8790V2haGX+ZO+Rg@mail.gmail.com>

On Mon, Jul 09, 2018 at 03:55:00PM +0530, Subrahmanya Lingappa wrote:
> Hi Lorenzo,
> 
> Our reference IP's hardware registers require the to support 256GB
> inbound window size and this driver did exactly that I believe.

No it does not, please check what this patch does, the window size
is not currently configured as you wish.

More importantly, nobody can even test it given that this driver lacks a
Kconfig and a Makefile entry unless I am missing something, I presume
they were lost in patch reviews but you ought to fix this as soon as
possible please since this was something I should not have missed.

> May I ask, why do you think this size is questionable ?

The macro is not questionable, it is buggy, the size is what you
tell me it should be, I agree.

Lorenzo

> 
> Thanks.
> 
> 
> On Fri, Jul 6, 2018 at 4:56 PM, Lorenzo Pieralisi
> <lorenzo.pieralisi@arm.com> wrote:
> > On Thu, Jul 05, 2018 at 12:45:39PM +0300, Dan Carpenter wrote:
> >> IB_WIN_SIZE is larger than INT_MAX so we need to cast it to u64.
> >>
> >> Fixes: 9af6bcb11e12 ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver")
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >> ---
> >> Untested...  Possibly the problem is that there are too many multiplies
> >> by * 1024.
> >
> > Hi Subrahmanya,
> >
> > I always thought that that macro value was questionable, please
> > can you comment on this ?
> >
> > Thanks,
> > Lorenzo
> >
> >> diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c
> >> index 4d6c20e47bed..cf0aa7cee5b0 100644
> >> --- a/drivers/pci/controller/pcie-mobiveil.c
> >> +++ b/drivers/pci/controller/pcie-mobiveil.c
> >> @@ -107,7 +107,7 @@
> >>  #define CFG_WINDOW_TYPE      0
> >>  #define IO_WINDOW_TYPE               1
> >>  #define MEM_WINDOW_TYPE      2
> >> -#define IB_WIN_SIZE          (256 * 1024 * 1024 * 1024)
> >> +#define IB_WIN_SIZE          ((u64)256 * 1024 * 1024 * 1024)
> >>  #define MAX_PIO_WINDOWS      8
> >>
> >>  /* Parameters for the waiting for link up routine */

  reply	other threads:[~2018-07-09 11:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05  9:45 [PATCH] PCI: mobiveil: integer overflow in IB_WIN_SIZE Dan Carpenter
2018-07-06 11:26 ` Lorenzo Pieralisi
2018-07-09 10:37   ` Subrahmanya Lingappa
2018-07-09 11:42     ` Lorenzo Pieralisi [this message]
2018-07-16  6:52       ` Subrahmanya Lingappa
2018-07-26  9:46         ` Lorenzo Pieralisi
2018-07-26 10:56 ` Lorenzo Pieralisi
2018-08-01  7:19   ` Subrahmanya Lingappa

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=20180709114241.GA1798@e107981-ln.cambridge.arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=l.subrahmanya@mobiveil.co.in \
    --cc=linux-pci@vger.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