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: 19514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1922818wru; Sun, 13 Nov 2022 18:22:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vrRZ+PK/zE8emQMwrE1ekDS/3lhVqYVSskI54UFtivcOJkL42MVVE/A6iiw5hLPYr59ue X-Received: by 2002:aa7:d3da:0:b0:460:9994:1b9b with SMTP id o26-20020aa7d3da000000b0046099941b9bmr9244792edr.155.1668392529177; Sun, 13 Nov 2022 18:22:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668392529; cv=none; d=google.com; s=arc-20160816; b=J2ogt3coNOGbCgsTJOWzHDh5VO5upefqKo/c8WFZdayBYHrI37pFVH6KfUDwlO6UtR sk+oWP3HWVqg2ky3me9SHZ6QZJ1ii9XwIfncjNVimgZnHtKCvp/pa7cm6KRvYL5CCaCh N2nMTXDrjSThEt7QrA80Q0curbsQH1BzeMInG5zMjaSdWqqJQ/+PVE1DQBHn9LT2FrwQ 1EQWnsXMyouwf9rkztBr8a62Pa5qpVX9Sv5HPIK43EPqeOMzkWWOkEzaG7NX7Ian4Dbo lMIwTqazPyQu0APtRuBMYi7xKps8t0JN0GUO5iwBIPwydHGfxSbFto0cR+deIrSnU7xi tW6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Wwe/CGewB3ONcgBOsjiiofH3aqvCPDJMHiAaI9g1bPo=; b=Ec3dJkFQvyW08ySlfmyp5sPSANTpaJ0QfNOnUNMPyfBiwkT1pYIdgrHR3BcsrwpJX+ R60ZTZW/5cYubpjkrjWrxbDX4JotViU+lSm6sXAs4zznSTf/gY8JoMK8eL9Qslw6Pd8I dlBBTUwYQ6qN40t66Lp3HTBrwg4aUlw5GJkuNngx6WDbztiL+OUU1EW85afSatxRzZsb ro3BS63rteamNkvV/zwI5oNCc5Nc850OMXgLwuYUWMMMnbXZDRWhK0w3ejlQ+cJMA2q6 x/qs1baeUH0AD9r/pDFja7Wb5d0hvAAE+Y5V9t4NW0EhW2uAH26UoxsWXddstKQRt9fw o2pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QfydQIAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a056402278800b0046771defe07si6951281ede.529.2022.11.13.18.21.45; Sun, 13 Nov 2022 18:22:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QfydQIAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235563AbiKNCOi (ORCPT + 99 others); Sun, 13 Nov 2022 21:14:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235462AbiKNCOf (ORCPT ); Sun, 13 Nov 2022 21:14:35 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 911FAF037 for ; Sun, 13 Nov 2022 18:14:34 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id y13so9757633pfp.7 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=DSiCSA0BVOukP2Wua+nSVdw6NevclBCI822Aztnr9gap425voTKc1YAULoweCkrrfZ B86GWwkCL1t3Iai+D+W0KbNKZ1xVCTojyWwmp3wyKB1VKnPiGVoalgi/Z2ly5PAapLJD ZL6prAMyAXfAbFUlr2zHABh3+lexh97J7TUKSoZ1KaMWgINe5ywCP4Y44GO8WT5rz1zS EH8vQ7J3hY3KlZkjEWkXLXDBd+yGUtxPPXj9CNcCwYx0kM9OhUK+EO49bi7OGSfYuyZV ExBRGn5k6SzKma5m07/x6wvN6cP4iYEniiL8ymhNEGzxLgDqCXGg2ffJIsGEaemPGh4U R/gQ== X-Gm-Message-State: ANoB5plV8dwei4kqzgkvxJIoNq0Kzy0al88wC1jQ474ELVbHgMmU517X peokrBmbFJKko9ROkajiY56LSw== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749436364450344269?= X-GMAIL-MSGID: =?utf-8?q?1749436364450344269?= 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;