lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 14 Mar 2013 10:30:25 -0500
From:	scameron@...rdog.cce.hp.com
To:	Wei Yongjun <weiyj.lk@...il.com>
Cc:	mike.miller@...com, axboe@...nel.dk, akpm@...ux-foundation.org,
	yongjun_wei@...ndmicro.com.cn, iss_storagedev@...com,
	linux-kernel@...r.kernel.org, scameron@...rdog.cce.hp.com
Subject: Re: [PATCH] cciss: fix invalid use of sizeof in cciss_find_cfgtables()

On Thu, Mar 14, 2013 at 11:19:45PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@...ndmicro.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@...ndmicro.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ