diff options
| author | Anand Avati <avati@redhat.com> | 2013-08-21 17:34:02 -0700 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2013-08-22 11:43:17 -0700 | 
| commit | 498a26b0307f2050e245c8d9330ba447c792d55d (patch) | |
| tree | 456428c4fb5d2edf2004507604ff87c5bbe4774f | |
| parent | 9cef2810909cf260762b7b9837c5a9fa67f8033c (diff) | |
io-cache: fix unsafe typcasting of pointer to uint64
The typecast of pointer to uint64_t *, followed by setting of
64bit in inode_ctx_get() results in memory corruption on 32bit
system.
Change-Id: I32fa3bf3b853ed2690a9b9a471099a59b9d7186a
BUG: 997902
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/5682
Tested-by: Morten Johansen <morten@bzzt.no>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
| -rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 4 | 
1 files changed, 3 insertions, 1 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index f56a574564a..68ca4c56515 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -316,9 +316,11 @@ ioc_forget (xlator_t *this, inode_t *inode)  static int32_t  ioc_invalidate(xlator_t *this, inode_t *inode)  { +	uint64_t     ioc_addr = 0;  	ioc_inode_t *ioc_inode = NULL; -	inode_ctx_get(inode, this, (uint64_t *) &ioc_inode); +	inode_ctx_get(inode, this, (uint64_t *) &ioc_addr); +	ioc_inode = (void *) ioc_addr;  	if (ioc_inode)  		ioc_inode_flush(ioc_inode);  | 
