Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp453660rwb; Wed, 9 Nov 2022 04:53:23 -0800 (PST) X-Google-Smtp-Source: AMsMyM5plbA76qDu+a9LSU5T0fZoey/xyUk4DLWDUYbp+Hae+Mb3Oos7FD5f3BTYW83q4wV19t9A X-Received: by 2002:a17:906:6a24:b0:7ad:f2df:51b7 with SMTP id qw36-20020a1709066a2400b007adf2df51b7mr41163064ejc.54.1667998403673; Wed, 09 Nov 2022 04:53:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667998403; cv=none; d=google.com; s=arc-20160816; b=uXAdOWgPAd6UNYIzQ2YK3G3uYjtrYlAjRfsIATFZPoV151eRaCJ6VKnm5FDTpunQEk AGQmMPvxcCCXSYMKWxs2v0h5dbkL3OUEQcShLRGl0V5WSPgSmw9rwMtm+PoBoC4RxYq2 Bg3LvMiNZHukG6HiOgREjwiObQ0afVVYjBsgOpNOXvYQleVvRsfmoJ41HP0IX5i8eAcG xiq6xm91Y0PjbiTtP8WAhaQ6VFUDidDn9a9B3qE1HURHYU4IvfUNS4gcTpxH5CceKKmv heY9FRoncDDU3kkROFjpWSeFtkhvxS53Z7tTggzgh6YYAbfE39A3WTHez+UmrsFyQ6aA +meA== 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=OrGYS/B095/vslNpGaloFjOxqBhLq5gvc4x2z/Y4AM0=; b=YX1V3IKbjuIuiH/Im8RrY1T2R6sfjV9Dm4ztGQvOa1QNyNheN0wbjUUK/xNU+LEx37 fdAu+tNsc4pj1h99/ICN2o9FnOI6uB49QJdbx0EQj8irwBSNYw/byMcNTdL3lJuPeJE+ zGnsDUDOj5FCrxOSmSUPYQ+i4ToX1Tz+VavxyWM+p+4XcVzYl9OruS/ZzVAidPMq6Hq9 m+SCjAptI4kcl83CCNPcDpdn+VgoaVf+aF81vEt6ojcba0WUZ7spsAhmrlV4hXHGD5cP U0ecN50OsE6JNJxOQ87CABOFQB1UEkizYyP9r8Ml+1yjTkrQkqdbkQ9MtsNtNiwZUKbS oa1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="eHdjWLt/"; 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 dm20-20020a170907949400b00783b75ec298si15649613ejc.395.2022.11.09.04.53.00; Wed, 09 Nov 2022 04:53:23 -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="eHdjWLt/"; 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 S229841AbiKIMYU (ORCPT + 93 others); Wed, 9 Nov 2022 07:24:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230034AbiKIMYS (ORCPT ); Wed, 9 Nov 2022 07:24:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A21E8165B7; Wed, 9 Nov 2022 04:24:17 -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 48279619B0; Wed, 9 Nov 2022 12:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2340C433C1; Wed, 9 Nov 2022 12:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667996656; bh=DI1kLMp44xPVivyHSAligYnyPf6dFzjoVZS6wmJz3vI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=eHdjWLt/D/I6Taff/2jooQHAvslWkKHU6ukiP4v30Dpwr6niXIzlfm6J1oh4A0LOb FhricsW+pWU6T0vcC7kx7q2f/u5HMBWg4yQA5PjSqAcUQqtmnBJhASjFjua3PxFMUQ n9ErCO4lk0M4DX01a2T6bBoA0+hawX0p6WTLANsfH9F1b1aIG37cD1cMmHsozV6C4K e8lzz+JwXp/+tlKwGJ6dswbatIvBidiiU3Z5w4sspScq85QXxD9M8vssWok2yXNer0 9Vtilwh7bu/DRujyg9IhhMgZhOFQsmP7xsJ1A1qQAdqY2QD3vPoS1U6p8lJUVL68ce WJ/51EHeqbmpQ== Message-ID: Date: Wed, 9 Nov 2022 14:24:12 +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: [PATCH] memory: omap-gpmc: fix coverity issue "Control flow issues" Content-Language: en-US To: "B. Niedermayr" , linux-next@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-hardening@vger.kernel.org, keescook@chromium.org, krzysztof.kozlowski@linaro.org, tony@atomide.com, gustavo@embeddedor.com References: <20221109102454.174320-1-benedikt.niedermayr@siemens.com> From: Roger Quadros In-Reply-To: <20221109102454.174320-1-benedikt.niedermayr@siemens.com> 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 On 09/11/2022 12:24, B. Niedermayr wrote: > From: Benedikt Niedermayr > > Assign a big positive integer instead of an negative integer to an > u32 variable. Also remove the check for ">= 0" which doesn't make sense > for unsigned integers. > > Reported-by: coverity-bot > Addresses-Coverity-ID: 1527139 ("Control flow issues") > Fixes: 89aed3cd5cb9 ("memory: omap-gpmc: wait pin additions") > Signed-off-by: Benedikt Niedermayr Reviewed-by: Roger Quadros > --- > drivers/memory/omap-gpmc.c | 2 +- > include/linux/platform_data/gpmc-omap.h | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c > index e427572712e2..57d9f91fe89b 100644 > --- a/drivers/memory/omap-gpmc.c > +++ b/drivers/memory/omap-gpmc.c > @@ -1045,7 +1045,7 @@ EXPORT_SYMBOL(gpmc_cs_free); > > static bool gpmc_is_valid_waitpin(u32 waitpin) > { > - return waitpin >= 0 && waitpin < gpmc_nr_waitpins; > + return waitpin < gpmc_nr_waitpins; > } > > static int gpmc_alloc_waitpin(struct gpmc_device *gpmc, > diff --git a/include/linux/platform_data/gpmc-omap.h b/include/linux/platform_data/gpmc-omap.h > index 296b080c5c67..dcca6c5e23bb 100644 > --- a/include/linux/platform_data/gpmc-omap.h > +++ b/include/linux/platform_data/gpmc-omap.h > @@ -137,11 +137,11 @@ struct gpmc_device_timings { > #define GPMC_MUX_AD 2 /* Addr-Data multiplex */ > > /* Wait pin polarity values */ > -#define GPMC_WAITPINPOLARITY_INVALID -1 > +#define GPMC_WAITPINPOLARITY_INVALID UINT_MAX > #define GPMC_WAITPINPOLARITY_ACTIVE_LOW 0 > #define GPMC_WAITPINPOLARITY_ACTIVE_HIGH 1 > > -#define GPMC_WAITPIN_INVALID -1 > +#define GPMC_WAITPIN_INVALID UINT_MAX > > struct gpmc_settings { > bool burst_wrap; /* enables wrap bursting */ -- cheers, -roger