From 498a26b0307f2050e245c8d9330ba447c792d55d Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Wed, 21 Aug 2013 17:34:02 -0700 Subject: 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 Reviewed-on: http://review.gluster.org/5682 Tested-by: Morten Johansen Tested-by: Gluster Build System Reviewed-by: Santosh Pradhan Reviewed-by: Brian Foster --- xlators/performance/io-cache/src/io-cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index f56a5745..68ca4c56 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); -- cgit