From: scameron@beardog.cce.hp.com
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: mike.miller@hp.com, axboe@kernel.dk, akpm@linux-foundation.org,
yongjun_wei@trendmicro.com.cn, iss_storagedev@hp.com,
linux-kernel@vger.kernel.org, scameron@beardog.cce.hp.com
Subject: Re: [PATCH] cciss: fix invalid use of sizeof in cciss_find_cfgtables()
Date: Thu, 14 Mar 2013 10:30:25 -0500 [thread overview]
Message-ID: <20130314153025.GJ28545@beardog.cce.hp.com> (raw)
In-Reply-To: <CAPgLHd-8dxVHPbeZgcSu3XcyJozuws5YUftDO3W9W1OQVGy1Kw@mail.gmail.com>
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
next prev parent reply other threads:[~2013-03-14 15:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 15:19 Wei Yongjun
2013-03-14 15:30 ` scameron [this message]
2013-03-22 15:11 ` Jens Axboe
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=20130314153025.GJ28545@beardog.cce.hp.com \
--to=scameron@beardog.cce.hp.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=iss_storagedev@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.miller@hp.com \
--cc=weiyj.lk@gmail.com \
--cc=yongjun_wei@trendmicro.com.cn \
/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
Powered by JetHome