Fixes crash on very big buffers allocations reported by Matteo Tescione <matteo@rmnet...
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 1 Mar 2010 19:41:14 +0000 (19:41 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 1 Mar 2010 19:41:14 +0000 (19:41 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@1527 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_mem.c

index 8cd7067..52250c7 100644 (file)
@@ -1329,7 +1329,7 @@ static int sgv_pool_init(struct sgv_pool *pool, const char *name,
                pool->purge_interval = SGV_DEFAULT_PURGE_INTERVAL;
        if (single_alloc_pages == 0) {
                pool->max_caches = SGV_POOL_ELEMENTS;
-               pool->max_cached_pages = 1 << SGV_POOL_ELEMENTS;
+               pool->max_cached_pages = 1 << (SGV_POOL_ELEMENTS - 1);
        } else {
                pool->max_caches = 1;
                pool->max_cached_pages = single_alloc_pages;