linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: omap-gpmc: fix wait pin validation
@ 2022-12-09 10:58 B. Niedermayr
  2022-12-09 11:04 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: B. Niedermayr @ 2022-12-09 10:58 UTC (permalink / raw)
  To: linux-next
  Cc: Benedikt Niedermayr, Tony Lindgren, Rob Herring,
	Krzysztof Kozlowski, Roger Quadros

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: Tony Lindgren <tony@atomide.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Roger Quadros <rogerq@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] 7+ messages in thread

* Re: [PATCH] memory: omap-gpmc: fix wait pin validation
  2022-12-09 10:58 [PATCH] memory: omap-gpmc: fix wait pin validation B. Niedermayr
@ 2022-12-09 11:04 ` Krzysztof Kozlowski
  2022-12-09 11:10   ` Niedermayr, BENEDIKT
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2022-12-09 11:04 UTC (permalink / raw)
  To: B. Niedermayr, linux-next
  Cc: Tony Lindgren, Rob Herring, Krzysztof Kozlowski, Roger Quadros

On 09/12/2022 11:58, 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.

Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC.  It might happen, that command when run on an older
kernel, gives you outdated entries.  Therefore please be sure you base
your patches on recent Linux kernel.

I think you got only two addresses right in your entire CC/To list...

Please resend with correct addresses.


> 
> 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: Tony Lindgren <tony@atomide.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>

Do not store maintainer entries in git log. There is no point.
Maintainer addresses come automatically and there is never a need to
keep automatic output in the history. Keep only people who need to be CCed.



Best regards,
Krzysztof


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

* Re: [PATCH] memory: omap-gpmc: fix wait pin validation
  2022-12-09 11:04 ` Krzysztof Kozlowski
@ 2022-12-09 11:10   ` Niedermayr, BENEDIKT
  2022-12-09 11:15     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Niedermayr, BENEDIKT @ 2022-12-09 11:10 UTC (permalink / raw)
  To: linux-next, krzysztof.kozlowski
  Cc: rogerq, tony, krzysztof.kozlowski+dt, robh+dt

On Fri, 2022-12-09 at 12:04 +0100, Krzysztof Kozlowski wrote:
> On 09/12/2022 11:58, 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.
> 
> Please use scripts/get_maintainers.pl to get a list of necessary people
> and lists to CC.  It might happen, that command when run on an older
> kernel, gives you outdated entries.  Therefore please be sure you base
> your patches on recent Linux kernel.
> 
> I think you got only two addresses right in your entire CC/To list...
> 
> Please resend with correct addresses.
OK.

> 
> 
> > 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: Tony Lindgren <tony@atomide.com>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> 
> Do not store maintainer entries in git log. There is no point.
> Maintainer addresses come automatically and there is never a need to
> keep automatic output in the history. Keep only people who need to be
> CCed.
> 
I wrongly thought I should Cc all people who have been Cc'ed on the
discussion.
Sorry, for that.
> 
> Best regards,
> Krzysztof
> 

cheers,
Benedikt


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

* Re: [PATCH] memory: omap-gpmc: fix wait pin validation
  2022-12-09 11:10   ` Niedermayr, BENEDIKT
@ 2022-12-09 11:15     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2022-12-09 11:15 UTC (permalink / raw)
  To: Niedermayr, BENEDIKT, linux-next
  Cc: rogerq, tony, krzysztof.kozlowski+dt, robh+dt

On 09/12/2022 12:10, Niedermayr, BENEDIKT wrote:
> On Fri, 2022-12-09 at 12:04 +0100, Krzysztof Kozlowski wrote:
>> On 09/12/2022 11:58, 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.
>>
>> Please use scripts/get_maintainers.pl to get a list of necessary people
>> and lists to CC.  It might happen, that command when run on an older
>> kernel, gives you outdated entries.  Therefore please be sure you base
>> your patches on recent Linux kernel.
>>
>> I think you got only two addresses right in your entire CC/To list...
>>
>> Please resend with correct addresses.
> OK.
> 
>>
>>
>>> 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: Tony Lindgren <tony@atomide.com>
>>> Cc: Rob Herring <robh+dt@kernel.org>
>>> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
>>
>> Do not store maintainer entries in git log. There is no point.
>> Maintainer addresses come automatically and there is never a need to
>> keep automatic output in the history. Keep only people who need to be
>> CCed.
>>
> I wrongly thought I should Cc all people who have been Cc'ed on the
> discussion.
> Sorry, for that.

You can Cc them, that's okay, but Roger, Tony and me are maintainers, so
there is no need to store these addresses in the git log.

Best regards,
Krzysztof


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

* Re: [PATCH] memory: omap-gpmc: fix wait pin validation
  2022-12-09 12:31 B. Niedermayr
  2022-12-12  7:16 ` Tony Lindgren
@ 2022-12-12  9:08 ` Roger Quadros
  1 sibling, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2022-12-12  9:08 UTC (permalink / raw)
  To: B. Niedermayr, linux-next, Tony Lindgren, Krzysztof Kozlowski
  Cc: Rob Herring,
	open list:OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT,
	open list:MEMORY CONTROLLER DRIVERS



On 09/12/2022 14:31, 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:
> 
> ...
> 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>

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

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

* Re: [PATCH] memory: omap-gpmc: fix wait pin validation
  2022-12-09 12:31 B. Niedermayr
@ 2022-12-12  7:16 ` Tony Lindgren
  2022-12-12  9:08 ` Roger Quadros
  1 sibling, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2022-12-12  7:16 UTC (permalink / raw)
  To: B. Niedermayr
  Cc: linux-next, Roger Quadros, Krzysztof Kozlowski, Rob Herring,
	open list:OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT,
	open list:MEMORY CONTROLLER DRIVERS

* B. Niedermayr <benedikt.niedermayr@siemens.com> [221209 12:32]:
> 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)
> ...

This fixes the issue thanks:

Tested-by: Tony Lindgren <tony@atomide.com>

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

* [PATCH] memory: omap-gpmc: fix wait pin validation
@ 2022-12-09 12:31 B. Niedermayr
  2022-12-12  7:16 ` Tony Lindgren
  2022-12-12  9:08 ` Roger Quadros
  0 siblings, 2 replies; 7+ messages in thread
From: B. Niedermayr @ 2022-12-09 12:31 UTC (permalink / raw)
  To: linux-next, Roger Quadros, Tony Lindgren, Krzysztof Kozlowski,
	Benedikt Niedermayr
  Cc: Rob Herring,
	open list:OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT,
	open list:MEMORY CONTROLLER DRIVERS

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] 7+ messages in thread

end of thread, other threads:[~2022-12-12  9:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 10:58 [PATCH] memory: omap-gpmc: fix wait pin validation B. Niedermayr
2022-12-09 11:04 ` Krzysztof Kozlowski
2022-12-09 11:10   ` Niedermayr, BENEDIKT
2022-12-09 11:15     ` Krzysztof Kozlowski
2022-12-09 12:31 B. Niedermayr
2022-12-12  7:16 ` Tony Lindgren
2022-12-12  9:08 ` Roger Quadros

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