All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
Cc: 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: Fri, 06 Jul 2018 11:26:52 +0000	[thread overview]
Message-ID: <20180706112652.GA14650@red-moon> (raw)
In-Reply-To: <20180705094539.xkmtfffbzl3kooum@kili.mountain>

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 */

WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
Cc: 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: Fri, 6 Jul 2018 12:26:52 +0100	[thread overview]
Message-ID: <20180706112652.GA14650@red-moon> (raw)
In-Reply-To: <20180705094539.xkmtfffbzl3kooum@kili.mountain>

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-06 11:26 UTC|newest]

Thread overview: 16+ 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-05  9:45 ` Dan Carpenter
2018-07-06 11:26 ` Lorenzo Pieralisi [this message]
2018-07-06 11:26   ` Lorenzo Pieralisi
2018-07-09 10:25   ` Subrahmanya Lingappa
2018-07-09 10:37     ` Subrahmanya Lingappa
2018-07-09 11:42     ` Lorenzo Pieralisi
2018-07-09 11:42       ` Lorenzo Pieralisi
2018-07-16  6:40       ` Subrahmanya Lingappa
2018-07-16  6:52         ` Subrahmanya Lingappa
2018-07-26  9:46         ` Lorenzo Pieralisi
2018-07-26  9:46           ` Lorenzo Pieralisi
2018-07-26 10:56 ` Lorenzo Pieralisi
2018-07-26 10:56   ` Lorenzo Pieralisi
2018-08-01  7:07   ` Subrahmanya Lingappa
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=20180706112652.GA14650@red-moon \
    --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 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.