linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] memory: omap-gpmc: fix wait pin validation
@ 2022-12-09 11:28 B. Niedermayr
  2022-12-09 11:35 ` Krzysztof Kozlowski
  2022-12-27  8:59 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 3+ messages in thread
From: B. Niedermayr @ 2022-12-09 11:28 UTC (permalink / raw)
  To: linux-next; +Cc: krzysztof.kozlowski, tony, robh+dt, Benedikt Niedermayr

From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>

This bug has been introduced after switching from -1 to UINT_MAX
for GPMC_WAITPIN_INVALID.

The bug leads to an error when the optional gpmc,wait-pin
dt-property is not used:

...
gpmc_cs_program_settings: invalid wait-pin (-1)
...

Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
Fixes: 8dd7e4af5853 ("memory: omap-gpmc: fix coverity issue "Control flow issues"")
Cc: Rob Herring <robh+dt@kernel.org>
---
 drivers/memory/omap-gpmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 57d9f91fe89b..d78f73db37c8 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -1918,7 +1918,8 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
 		}
 	}
 
-	if (p->wait_pin > gpmc_nr_waitpins) {
+	if (p->wait_pin != GPMC_WAITPIN_INVALID &&
+	    p->wait_pin > gpmc_nr_waitpins) {
 		pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin);
 		return -EINVAL;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] memory: omap-gpmc: fix wait pin validation
  2022-12-09 11:28 [PATCH v2] memory: omap-gpmc: fix wait pin validation B. Niedermayr
@ 2022-12-09 11:35 ` Krzysztof Kozlowski
  2022-12-27  8:59 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-12-09 11:35 UTC (permalink / raw)
  To: B. Niedermayr, linux-next; +Cc: tony, robh+dt

On 09/12/2022 12:28, B. Niedermayr wrote:
> From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
> 
> This bug has been introduced after switching from -1 to UINT_MAX
> for GPMC_WAITPIN_INVALID.
> 
> The bug leads to an error when the optional gpmc,wait-pin
> dt-property is not used:

That's still not fully correct CC list. Just automate sending (combine
git send-email with get_maintainers) to avoid any errors. You can use b4
for this or:

[sendemail.linux]
        tocmd ="scripts/get_maintainer.pl --nogit --nogit-fallback --nol"
        cccmd ="scripts/get_maintainer.pl --nogit --nogit-fallback --nom"
        confirm = always

git send-email --identity=linux ...

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] memory: omap-gpmc: fix wait pin validation
  2022-12-09 11:28 [PATCH v2] memory: omap-gpmc: fix wait pin validation B. Niedermayr
  2022-12-09 11:35 ` Krzysztof Kozlowski
@ 2022-12-27  8:59 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-12-27  8:59 UTC (permalink / raw)
  To: linux-next, B. Niedermayr; +Cc: Krzysztof Kozlowski, robh+dt, tony

On Fri, 9 Dec 2022 12:28:28 +0100, B. Niedermayr wrote:
> From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
> 
> This bug has been introduced after switching from -1 to UINT_MAX
> for GPMC_WAITPIN_INVALID.
> 
> The bug leads to an error when the optional gpmc,wait-pin
> dt-property is not used:
> 
> [...]

Applied, thanks!

[1/1] memory: omap-gpmc: fix wait pin validation
      https://git.kernel.org/krzk/linux-mem-ctrl/c/827e0920dbfb0d92416e56081d70745597403446

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-27  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 11:28 [PATCH v2] memory: omap-gpmc: fix wait pin validation B. Niedermayr
2022-12-09 11:35 ` Krzysztof Kozlowski
2022-12-27  8:59 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).