Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1451293rwb; Mon, 7 Nov 2022 01:37:42 -0800 (PST) X-Google-Smtp-Source: AMsMyM5CyctfNZWED8axTycCuXtmA9knYOQAj3UC4UJJ/UDjSaROD9C0ldVY+jF9EsqVxZGQbBFY X-Received: by 2002:a17:907:3e14:b0:7ae:4066:a0f2 with SMTP id hp20-20020a1709073e1400b007ae4066a0f2mr13779596ejc.446.1667813862351; Mon, 07 Nov 2022 01:37:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667813862; cv=none; d=google.com; s=arc-20160816; b=yMEEVWplffB1howBA2z474TXUDoU+uA8trKOkS9XQliAPyKBGkSS+DsmYYM3Zs7CKB WSP9FKWpyJQm47l9YI7csSZW9rlmIcnO90kZ21y+8ed8L/HyIaYm28fEbiT18jL07v4O Hq2YloIwaXcbXow3/j0Nvi+6QiuDVNjupMahTBK9BkVc103Te6fUqYu30yWqgx947sT/ eTDL3HEHhE1o2AkrFrQvuWnOMKE0rFnjcvhv61041cb8Mm5iF80v2sB5X3DExnSq3/X9 wL7JDpkIHmAfu2y5e85BZCbEQqxLQv88997M43bBqxkn3Fyb2vjxhvnBAiPWOQ3q/CDJ 4Gew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9iyptcDCwgKQ2v0WjIoEcfhBnd5sEEbSPIgiIsfnohc=; b=epy5io1fBiv+oFPBx66jvI9doN7zAagsTtn0P7pAnbsPagMEsoXhdHRknRWz09jRwc 1GPjoQwgmCwGZA2uFHGbwzyOFEddt+5qogiGf1Q1hv8p4futoI9VxhO5Q6xZ6OeCFLZ1 7jg9J8wlS0K8MMeGbu/4I23dSueIG8QwsAWYd1XG70u8kxlHw/kPzk4UoFNksk9zMzWK dPaS/c2VV3cPXQulwLM7JgC1kMB+EMZDY4uYLnQR0i0Mr7sM4bR0F2z7EIEO8KhBum/s 278s87OT2dXyggE6bAAYNGMEG/cbuK7Ft6cii6fhnmMWWkRfqgyY34Pn5iaXbXfTXugM +F+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m3uI7jAR; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z7-20020a056402274700b0045c31d9643bsi10690294edd.2.2022.11.07.01.37.19; Mon, 07 Nov 2022 01:37:42 -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=@kernel.org header.s=k20201202 header.b=m3uI7jAR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231235AbiKGIyB (ORCPT + 95 others); Mon, 7 Nov 2022 03:54:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231448AbiKGIx7 (ORCPT ); Mon, 7 Nov 2022 03:53:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC3C5F6C; Mon, 7 Nov 2022 00:53:58 -0800 (PST) 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 E0C5460F49; Mon, 7 Nov 2022 08:53:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5760AC433C1; Mon, 7 Nov 2022 08:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667811237; bh=MkGqyvrlKZCyXWKRmtTmz66/zHNHcStkTmoWNHfjow0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=m3uI7jARqaZ3dTske6Q8K75F79f36XLSAdpj4g0a4dY6EN4VBldLunb4bhEhYkU7k VzoqAZMgr/xVZBpCCtq2e2TJEiYmxNpDxgC1dDq/X5peXL6YKRn0t7U0Vb7Y9iPFf0 ubWO1kzNSfbPGXo0hfjnUegDhstaltL6sqVYRixhsbKePiObtc76/ppoBIn8HQbDoA 6NX7AMUatoyB2fXlTWz4pXkUepETr+MaiDMqbjcuJgly8viRFNQYWpGrRNlRyDig+r YFFbTFQBYrSPbg+2iRWZF/HZaNjwTp2Vmn5Qx7QITRzEaOmkKrN8aUuryYgmZgg4Ms XeazdZG51CWpw== Message-ID: <7cdf3d14-3f1b-7cd4-e8b9-e94b5359bf82@kernel.org> Date: Mon, 7 Nov 2022 10:53:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Coverity: gpmc_is_valid_waitpin(): Control flow issues Content-Language: en-US To: coverity-bot , Benedikt Niedermayr Cc: Krzysztof Kozlowski , linux-kernel@vger.kernel.org, Tony Lindgren , linux-omap@vger.kernel.org, "Gustavo A. R. Silva" , linux-next@vger.kernel.org, linux-hardening@vger.kernel.org References: <202211041233.4D45359E7@keescook> From: Roger Quadros In-Reply-To: <202211041233.4D45359E7@keescook> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 Hi Benedikt, On 04/11/2022 21:33, coverity-bot wrote: > Hello! > > This is an experimental semi-automated report about issues detected by > Coverity from a scan of next-20221104 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 2 10:02:39 2022 -0400 > 89aed3cd5cb9 ("memory: omap-gpmc: wait pin additions") > > Coverity reported the following: > > *** CID 1527139: Control flow issues (NO_EFFECT) > drivers/memory/omap-gpmc.c:1048 in gpmc_is_valid_waitpin() > 1042 spin_unlock(&gpmc_mem_lock); > 1043 } > 1044 EXPORT_SYMBOL(gpmc_cs_free); > 1045 > 1046 static bool gpmc_is_valid_waitpin(u32 waitpin) We will need to change this waitpin argument to int. In addition we will also need to change struct gpmc_waitpin->pin and struct gpmc_setting->wait_pin to int as in the code we are relying on GPMC_WAITPIN_INVALID logic which is -1. > 1047 { > vvv CID 1527139: Control flow issues (NO_EFFECT) > vvv This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "waitpin >= 0U". > 1048 return waitpin >= 0 && waitpin < gpmc_nr_waitpins; > 1049 } > 1050 > 1051 static int gpmc_alloc_waitpin(struct gpmc_device *gpmc, > 1052 struct gpmc_settings *p) > 1053 { > > 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: 1527139 ("Control flow issues") > Fixes: 89aed3cd5cb9 ("memory: omap-gpmc: wait pin additions") > > Thanks for your attention! > cheers, -roger