* [PATCH] cciss: fix invalid use of sizeof in cciss_find_cfgtables()
@ 2013-03-14 15:19 Wei Yongjun
2013-03-14 15:30 ` scameron
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2013-03-14 15:19 UTC (permalink / raw)
To: mike.miller, scameron, axboe, akpm
Cc: yongjun_wei, iss_storagedev, linux-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
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 ade58bc..1c1b8e5 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4206,7 +4206,7 @@ static int 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] 3+ messages in thread
* Re: [PATCH] cciss: fix invalid use of sizeof in cciss_find_cfgtables()
2013-03-14 15:19 [PATCH] cciss: fix invalid use of sizeof in cciss_find_cfgtables() Wei Yongjun
@ 2013-03-14 15:30 ` scameron
2013-03-22 15:11 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: scameron @ 2013-03-14 15:30 UTC (permalink / raw)
To: Wei Yongjun
Cc: mike.miller, axboe, akpm, yongjun_wei, iss_storagedev,
linux-kernel, scameron
On Thu, Mar 14, 2013 at 11:19:45PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> sizeof() when applied to a pointer typed expression gives the
> size of the pointer, not that of the pointed data.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> 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 ade58bc..1c1b8e5 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -4206,7 +4206,7 @@ static int 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);
>
Ack.
I suppose it has worked all this time because ioremap can't map less
than a page, and sizeof(*h->cfgtable) is less than a page, and likely
starts on a page boundary.
-- steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cciss: fix invalid use of sizeof in cciss_find_cfgtables()
2013-03-14 15:30 ` scameron
@ 2013-03-22 15:11 ` Jens Axboe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2013-03-22 15:11 UTC (permalink / raw)
To: scameron
Cc: Wei Yongjun, mike.miller, akpm, yongjun_wei, iss_storagedev,
linux-kernel
On Thu, Mar 14 2013, scameron@beardog.cce.hp.com wrote:
> On Thu, Mar 14, 2013 at 11:19:45PM +0800, Wei Yongjun wrote:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> >
> > sizeof() when applied to a pointer typed expression gives the
> > size of the pointer, not that of the pointed data.
> >
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > ---
> > 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 ade58bc..1c1b8e5 100644
> > --- a/drivers/block/cciss.c
> > +++ b/drivers/block/cciss.c
> > @@ -4206,7 +4206,7 @@ static int 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);
> >
>
> Ack.
>
> I suppose it has worked all this time because ioremap can't map less
> than a page, and sizeof(*h->cfgtable) is less than a page, and likely
> starts on a page boundary.
Queued up for 3.9, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-22 15:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-14 15:19 [PATCH] cciss: fix invalid use of sizeof in cciss_find_cfgtables() Wei Yongjun
2013-03-14 15:30 ` scameron
2013-03-22 15:11 ` Jens Axboe
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).