From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: coverity-bot <keescook@chromium.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Alexey Romanov <avromanov@sberdevices.ru>,
linux-kernel@vger.kernel.org, Nick Terrell <terrelln@fb.com>,
Minchan Kim <minchan@kernel.org>,
Suleiman Souhlal <suleiman@google.com>,
Nitin Gupta <ngupta@vflare.org>, Jens Axboe <axboe@kernel.dk>,
Nhat Pham <nphamcs@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-block@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: Coverity: zram_recompress(): OVERRUN
Date: Fri, 11 Nov 2022 09:37:10 +0900 [thread overview]
Message-ID: <Y22ZNtdH9s+cuL9l@google.com> (raw)
In-Reply-To: <202211100847.388C61B3@keescook>
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.
next prev parent reply other threads:[~2022-11-11 0:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 16:47 Coverity: zram_recompress(): OVERRUN coverity-bot
2022-11-11 0:26 ` Sergey Senozhatsky
2022-11-11 3:15 ` Kees Cook
2022-11-11 10:39 ` Sergey Senozhatsky
2022-11-11 0:37 ` Sergey Senozhatsky [this message]
2022-11-11 0:42 ` Sergey Senozhatsky
2022-11-11 3:16 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y22ZNtdH9s+cuL9l@google.com \
--to=senozhatsky@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=avromanov@sberdevices.ru \
--cc=axboe@kernel.dk \
--cc=gustavo@embeddedor.com \
--cc=keescook@chromium.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=nphamcs@gmail.com \
--cc=suleiman@google.com \
--cc=terrelln@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).