From patchwork Mon Nov 14 02:14:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13041818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5B9FC4332F for ; Mon, 14 Nov 2022 02:14:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 067796B0074; Sun, 13 Nov 2022 21:14:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0179C6B0075; Sun, 13 Nov 2022 21:14:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E487E8E0001; Sun, 13 Nov 2022 21:14:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D8D776B0074 for ; Sun, 13 Nov 2022 21:14:35 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A0540C099E for ; Mon, 14 Nov 2022 02:14:35 +0000 (UTC) X-FDA: 80130428910.09.E4D941F Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf30.hostedemail.com (Postfix) with ESMTP id 2C9DD80009 for ; Mon, 14 Nov 2022 02:14:34 +0000 (UTC) Received: by mail-pf1-f177.google.com with SMTP id 140so8297416pfz.6 for ; Sun, 13 Nov 2022 18:14:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wwe/CGewB3ONcgBOsjiiofH3aqvCPDJMHiAaI9g1bPo=; b=QfydQIAZ7OUfGESB844uyKVezkoPzk9pGxEJSJeEcF8MzBqpkORyurGqSnjKDgGloJ 8acIS/W4obb/bmXsTuOdcBsJkfSES3o5VE8dBxYme+m3Ec18b6rW+1z+jmfemrfPC6NG g3VDmOxpG83xrOI5cot7fgFOFlAtcg1wEl06M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wwe/CGewB3ONcgBOsjiiofH3aqvCPDJMHiAaI9g1bPo=; b=iP12/46/lXW1lbGg1rfLQ1hRHzXXOtNbRwo35hiJrXLbrfigGI4YoRSwBmkN8HxaR4 fY2e3Z2NLfmAaG/WBK6wLBXqe6ibv5y2T0d8TvIe8oMOz+6WrE9B7nXTcNseEWWsRDeG NR+qzrlMpDA+1cZt7xEArgYbArFAqhD3qbEwZQPj8A4xR1aeKvmX6KvM71KhQXt/Asrk iyPRkEmhDQK5VpZYMnTQcMq8MSf7morfYduLsxq/kl6RjvuL3xrlMeGOv3M2Rd1oEr7x 0mxuovoTGeI/YFevWhtIt16FJt5BPh+G4vBK4ay3g80q58NYwRd9TcpLW66lwJJ8dDXX uCIQ== X-Gm-Message-State: ANoB5pkisD4dY/ZqUKyxY1Q5NnMIzoWa0OHWEWjx0XcLHlG3DuJ59PSW EMQJzjAHhOjvQIKGB1MoZhQ5Rw== X-Google-Smtp-Source: AA0mqf7AbZHqarqTcstWVSy2kvTab7yPcO0uhz/YyOOrJfvuuk4D/Hz987snCA+m7ZxIXS6VIDXjnA== X-Received: by 2002:a05:6a00:10c8:b0:562:3acc:7a63 with SMTP id d8-20020a056a0010c800b005623acc7a63mr11978799pfu.51.1668392074077; Sun, 13 Nov 2022 18:14:34 -0800 (PST) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:add6:3280:f7d1:25fc]) by smtp.gmail.com with ESMTPSA id l12-20020a170903244c00b0017f592a7eccsm5868740pls.298.2022.11.13.18.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Nov 2022 18:14:33 -0800 (PST) From: Sergey Senozhatsky To: Andrew Morton Cc: Minchan Kim , Nitin Gupta , Suleiman Souhlal , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky , coverity-bot Subject: [PATCH] zram: explicitly limit prio_max for static analyzers Date: Mon, 14 Nov 2022 11:14:20 +0900 Message-Id: <20221114021420.4060601-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221109115047.2921851-5-senozhatsky@chromium.org> References: <20221109115047.2921851-5-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668392075; a=rsa-sha256; cv=none; b=a1R+qj+NznDhf1hoVyG+WtAOAiJxZaHuTUw5H+aIC4l/+bh7yS3LZZjd0Nbe4SJfsMZQZ7 YTBD9IHYEorHWtV5NzQlRVXWSyM8XNleUK5k/M3liUnXysCoBOYe0A6euwNsWhmrHR1GdU Js5AGcyLQPlLrf4PC/NaGWz38RqML1Y= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=QfydQIAZ; spf=pass (imf30.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.177 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668392075; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Wwe/CGewB3ONcgBOsjiiofH3aqvCPDJMHiAaI9g1bPo=; b=hMjC5yb0ctgNi0hVWRASyGVCHEoOBXkxTNPa7KMFBSko2Mf2uSPryjCd0LNHw6KTcDVUsb 4GHD8NxVqHBIagdONCUrwSIgyrhP2KWJyRQPxwnjjxqs4nV4m6zKSVrLLxSDZLEdGxU7tQ v9vMCWyI6FpxWDJbb0SbwXkZ34HJINs= X-Stat-Signature: tczbnmwx7tz9asgmydcs8t8q74z36b84 X-Rspamd-Queue-Id: 2C9DD80009 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=QfydQIAZ; spf=pass (imf30.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.177 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1668392074-909872 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Reported-by: coverity-bot Signed-off-by: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 9d33801e8ba8..e67a124f2e88 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1706,6 +1706,7 @@ static int zram_recompress(struct zram *zram, u32 index, struct page *page, * Iterate the secondary comp algorithms list (in order of priority) * and try to recompress the page. */ + prio_max = min(prio_max, ZRAM_MAX_COMPS); for (; prio < prio_max; prio++) { if (!zram->comps[prio]) continue;