All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/block/cciss.c: correct size computation
@ 2012-04-21 14:08 ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2012-04-21 14:08 UTC (permalink / raw)
  To: Mike Miller; +Cc: kernel-janitors, iss_storagedev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

The size argument to remap_pci_mem should be the size of desired structure,
not the pointer to it.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression *x;
@@

x =
 <+...
-sizeof(x)
+sizeof(*x)
...+>
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/block/cciss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index b0f553b..9f50d7d 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4209,7 +4209,7 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h)
 	if (rc)
 		return rc;
 	h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev,
-		cfg_base_addr_index) + cfg_offset, sizeof(h->cfgtable));
+		cfg_base_addr_index) + cfg_offset, sizeof(*h->cfgtable));
 	if (!h->cfgtable)
 		return -ENOMEM;
 	rc = write_driver_ver_to_cfgtable(h->cfgtable);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] drivers/block/cciss.c: correct size computation
@ 2012-04-21 14:08 ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2012-04-21 14:08 UTC (permalink / raw)
  To: Mike Miller; +Cc: kernel-janitors, iss_storagedev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

The size argument to remap_pci_mem should be the size of desired structure,
not the pointer to it.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression *x;
@@

x  <+...
-sizeof(x)
+sizeof(*x)
...+>
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/block/cciss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index b0f553b..9f50d7d 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4209,7 +4209,7 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h)
 	if (rc)
 		return rc;
 	h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev,
-		cfg_base_addr_index) + cfg_offset, sizeof(h->cfgtable));
+		cfg_base_addr_index) + cfg_offset, sizeof(*h->cfgtable));
 	if (!h->cfgtable)
 		return -ENOMEM;
 	rc = write_driver_ver_to_cfgtable(h->cfgtable);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/block/cciss.c: correct size computation
  2012-04-21 14:08 ` Julia Lawall
@ 2012-04-23 15:08   ` Mike Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: Mike Miller @ 2012-04-23 15:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, ISS StorageDev, linux-kernel

On 04/21/2012 09:08 AM, Julia Lawall wrote:
> From: Julia Lawall<Julia.Lawall@lip6.fr>
>
> The size argument to remap_pci_mem should be the size of desired structure,
> not the pointer to it.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> //<smpl>
> @expression@
> expression *x;
> @@
>
> x =
>   <+...
> -sizeof(x)
> +sizeof(*x)
> ...+>
> //</smpl>
>
> Signed-off-by: Julia Lawall<Julia.Lawall@lip6.fr>
Acked-by: Mike Miller <mike.miller@hp.com>
>
> ---
>   drivers/block/cciss.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index b0f553b..9f50d7d 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -4209,7 +4209,7 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h)
>   	if (rc)
>   		return rc;
>   	h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev,
> -		cfg_base_addr_index) + cfg_offset, sizeof(h->cfgtable));
> +		cfg_base_addr_index) + cfg_offset, sizeof(*h->cfgtable));
>   	if (!h->cfgtable)
>   		return -ENOMEM;
>   	rc = write_driver_ver_to_cfgtable(h->cfgtable);
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/block/cciss.c: correct size computation
@ 2012-04-23 15:08   ` Mike Miller
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Miller @ 2012-04-23 15:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, ISS StorageDev, linux-kernel

On 04/21/2012 09:08 AM, Julia Lawall wrote:
> From: Julia Lawall<Julia.Lawall@lip6.fr>
>
> The size argument to remap_pci_mem should be the size of desired structure,
> not the pointer to it.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> //<smpl>
> @expression@
> expression *x;
> @@
>
> x >   <+...
> -sizeof(x)
> +sizeof(*x)
> ...+>
> //</smpl>
>
> Signed-off-by: Julia Lawall<Julia.Lawall@lip6.fr>
Acked-by: Mike Miller <mike.miller@hp.com>
>
> ---
>   drivers/block/cciss.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index b0f553b..9f50d7d 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -4209,7 +4209,7 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h)
>   	if (rc)
>   		return rc;
>   	h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev,
> -		cfg_base_addr_index) + cfg_offset, sizeof(h->cfgtable));
> +		cfg_base_addr_index) + cfg_offset, sizeof(*h->cfgtable));
>   	if (!h->cfgtable)
>   		return -ENOMEM;
>   	rc = write_driver_ver_to_cfgtable(h->cfgtable);
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-23 15:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-21 14:08 [PATCH] drivers/block/cciss.c: correct size computation Julia Lawall
2012-04-21 14:08 ` Julia Lawall
2012-04-23 15:08 ` Mike Miller
2012-04-23 15:08   ` Mike Miller

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.