From mboxrd@z Thu Jan 1 00:00:00 1970 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 9DC6CC4332F for ; Fri, 18 Nov 2022 00:05:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F32486B0071; Thu, 17 Nov 2022 19:05:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE2A56B0072; Thu, 17 Nov 2022 19:05:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAA7D8E0001; Thu, 17 Nov 2022 19:05:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C7F746B0071 for ; Thu, 17 Nov 2022 19:05:50 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9A339403A8 for ; Fri, 18 Nov 2022 00:05:50 +0000 (UTC) X-FDA: 80144619660.26.D2BDEEA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 33085140008 for ; Fri, 18 Nov 2022 00:05:49 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 32F22622CE; Fri, 18 Nov 2022 00:05:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 286C3C433D6; Fri, 18 Nov 2022 00:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668729947; bh=H8A+VfcBwEu+5oVlM/ylb1vTzqKOVIIzcbV2vdm5TRw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BNCkZVXFUcZFrQOGW2YcialIeFX2flA6n9/RBkJDbCfCY9LmBmCE3MgkOEZQfWc8B r1C0j6NWb7hABNH5zw6S8MnxBvSeFMlZzxMDwOFGI82U9okzQT0I/MYOTHkzR/VBlG ENEIaDjfLvFb3KLLNDmEjQYT7teUAImhdOIlX1ze7TlNZKGj0h/ahNC0kVQnrjTBXD t8C4O6KpOdHy4mcjNkwV1cgZDf0Y5SoGkSAgEpls7z9/IEA5mk9R0x2kJMw7BIi9Pz bvU5pLfmS/8q4QtuzGSU7s3OJNr7sCAjrhGiKIa9pNnqARqduJu4+EYFkIguGMlyx9 xr1LcP95PEu+g== Date: Thu, 17 Nov 2022 18:05:32 -0600 From: "Gustavo A. R. Silva" To: coverity-bot Cc: Ananda , Jonathan Corbet , linux-kernel@vger.kernel.org, Minchan Kim , Andrew Morton , Sergey Senozhatsky , linux-mm@kvack.org, linux-doc@vger.kernel.org, Vitaly Wool , "Gustavo A. R. Silva" , linux-next@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: Coverity: zblock_reclaim_block(): Control flow issues Message-ID: References: <202211171421.914F0F3719@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202211171421.914F0F3719@keescook> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668729949; a=rsa-sha256; cv=none; b=nqWOLByCRdFz3/OVsEqaP9jPyROhgF7Oo6DyaQfTIK+xbkj2v0jxL1zo0/5SwgB8SEMgSK uNqAAQ13lY2NMC0EH7sAEb09HC8qGaSxAfzhy8rJkevTKxoc32I7m9iBlq1uBhKS/G2WSa KAhlJLKbxpVP1v8+ddbqqsVcUDUVOBs= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BNCkZVXF; spf=pass (imf09.hostedemail.com: domain of gustavoars@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gustavoars@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668729949; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rP6ipgo8dzerI/G1dfYZbIwU5koXEJ4JhdiuK68bths=; b=V2ZKlrt4Hj3P+cS8HrB4d3hk4fbhsO6bbEFWf7lpfrM/LYeMoqntHqeQxcOFR5j6Xt1jfW zARLxQ+8W3WC4qXCHUwBslfUoKlNAE9g3nKaVMRR9z/S2qr/U87S0GKwWQTMZxDXEYOnUX 98/xOHMaPd15Hz1FUsM9UOx/1LYEJb8= X-Stat-Signature: 8pbrdkb3qaj6xseiw6o7a35cjb4yutaf X-Rspamd-Queue-Id: 33085140008 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BNCkZVXF; spf=pass (imf09.hostedemail.com: domain of gustavoars@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gustavoars@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1668729949-514941 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: On Thu, Nov 17, 2022 at 02:21:46PM -0800, coverity-bot wrote: > Hello! > > This is an experimental semi-automated report about issues detected by > Coverity from a scan of next-20221117 as part of the linux-next scan project: > https://scan.coverity.com/projects/linux-next-weekly-scan > > You're getting this email because you were associated with the identified > lines of code (noted below) that were touched by commits: > > Wed Nov 16 16:19:12 2022 -0800 > 9097e28c25c8 ("mm: add zblock - new allocator for use via zpool API") > > Coverity reported the following: > > *** CID 1527349: Control flow issues (NO_EFFECT) > mm/zblock.c:412 in zblock_reclaim_block() > 406 unsigned long handle, block_type, slot; > 407 int ret, i, reclaimed; > 408 > 409 /* start with list storing blocks with the worst compression and try > 410 * to evict the first added (oldest) block in this list > 411 */ > vvv CID 1527349: Control flow issues (NO_EFFECT) > vvv This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "block_type >= 0UL". > 412 for (block_type = ARRAY_SIZE(block_desc) - 1; block_type >= 0; --block_type) { This seems like a legit issue. -- Gustavo > 413 list = &(pool->block_lists[block_type]); > 414 spin_lock(&list->lock); > 415 > 416 /* find the oldest block in list */ > 417 block = list_last_entry(&list->head, struct zblock_block, block_node); > > If this is a false positive, please let us know so we can mark it as > such, or teach the Coverity rules to be smarter. If not, please make > sure fixes get into linux-next. :) For patches fixing this, please > include these lines (but double-check the "Fixes" first): > > Reported-by: coverity-bot > Addresses-Coverity-ID: 1527349 ("Control flow issues") > Fixes: 9097e28c25c8 ("mm: add zblock - new allocator for use via zpool API") > > Thanks for your attention! > > -- > Coverity-bot