public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@kernel.org>
To: "B. Niedermayr" <benedikt.niedermayr@siemens.com>,
	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
Subject: Re: [PATCH] memory: omap-gpmc: fix coverity issue "Control flow issues"
Date: Wed, 9 Nov 2022 14:24:12 +0200	[thread overview]
Message-ID: <b2509306-7d41-ff78-90ec-0d34dec762e6@kernel.org> (raw)
In-Reply-To: <20221109102454.174320-1-benedikt.niedermayr@siemens.com>



On 09/11/2022 12:24, B. Niedermayr wrote:
> From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
> 
> 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 <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1527139 ("Control flow issues")
> Fixes: 89aed3cd5cb9 ("memory: omap-gpmc: wait pin additions")
> Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>

Reviewed-by: Roger Quadros <rogerq@kernel.org>

> ---
>  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

  reply	other threads:[~2022-11-09 12:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 10:24 [PATCH] memory: omap-gpmc: fix coverity issue "Control flow issues" B. Niedermayr
2022-11-09 12:24 ` Roger Quadros [this message]
2022-11-10  9:14 ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2509306-7d41-ff78-90ec-0d34dec762e6@kernel.org \
    --to=rogerq@kernel.org \
    --cc=benedikt.niedermayr@siemens.com \
    --cc=gustavo@embeddedor.com \
    --cc=keescook@chromium.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox