[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Nov 2022 09:37:10 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: coverity-bot <keescook@...omium.org>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Alexey Romanov <avromanov@...rdevices.ru>,
linux-kernel@...r.kernel.org, Nick Terrell <terrelln@...com>,
Minchan Kim <minchan@...nel.org>,
Suleiman Souhlal <suleiman@...gle.com>,
Nitin Gupta <ngupta@...are.org>, Jens Axboe <axboe@...nel.dk>,
Nhat Pham <nphamcs@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-block@...r.kernel.org,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
linux-next@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: Coverity: zram_recompress(): OVERRUN
On (22/11/10 08:47), coverity-bot wrote:
[..]
> 1704 class_index_old = zs_lookup_class_index(zram->mem_pool, comp_len_old);
> 1705 /*
> 1706 * Iterate the secondary comp algorithms list (in order of priority)
> 1707 * and try to recompress the page.
> 1708 */
> 1709 for (; prio < prio_max; prio++) {
> vvv CID 1527270: (OVERRUN)
> vvv Overrunning array "zram->comps" of 4 8-byte elements at element index 4 (byte offset 39) using index "prio" (which evaluates to 4).
> 1710 if (!zram->comps[prio])
> 1711 continue;
> 1712
> 1713 /*
> 1714 * Skip if the object is already re-compressed with a higher
> 1715 * priority algorithm (or same algorithm).
prio_max is always limited and max value it can have is 4 (ZRAM_MAX_COMPS).
Depending on use case we can limit prio_max even to lower values.
So we have
for (; prio < 4; prio++) {
foo = comps[prio];
}
I don't see how prio can be 4 inside of this loop.
Powered by blists - more mailing lists