All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: sparx5: Fix initialization of variables on stack
@ 2022-03-04 14:09 ` Horatiu Vultur
  0 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-03-04 14:09 UTC (permalink / raw)
  To: netdev, linux-arm-kernel, linux-kernel, llvm
  Cc: davem, kuba, UNGLinuxDriver, Horatiu Vultur

The variables 'res' inside the functions sparx5_ptp_get_1ppm and
sparx5_ptp_get_nominal_value was not initialized. So in case of the default
case of the switch after, it would return an uninitialized variable.
This makes also the clang builds to failed.

Fixes: 0933bd04047c3b ("net: sparx5: Add support for ptp clocks")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
index fa377f6e7e08..cd110c31e5a4 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
@@ -32,7 +32,7 @@ static u64 sparx5_ptp_get_1ppm(struct sparx5 *sparx5)
 	 * (1/1000000)/((2^-59)/X)
 	 */
 
-	u64 res;
+	u64 res = 0;
 
 	switch (sparx5->coreclock) {
 	case SPX5_CORE_CLOCK_250MHZ:
@@ -54,7 +54,7 @@ static u64 sparx5_ptp_get_1ppm(struct sparx5 *sparx5)
 
 static u64 sparx5_ptp_get_nominal_value(struct sparx5 *sparx5)
 {
-	u64 res;
+	u64 res = 0;
 
 	switch (sparx5->coreclock) {
 	case SPX5_CORE_CLOCK_250MHZ:
-- 
2.33.0


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

* [PATCH net-next] net: sparx5: Fix initialization of variables on stack
@ 2022-03-04 14:09 ` Horatiu Vultur
  0 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-03-04 14:09 UTC (permalink / raw)
  To: netdev, linux-arm-kernel, linux-kernel, llvm
  Cc: davem, kuba, UNGLinuxDriver, Horatiu Vultur

The variables 'res' inside the functions sparx5_ptp_get_1ppm and
sparx5_ptp_get_nominal_value was not initialized. So in case of the default
case of the switch after, it would return an uninitialized variable.
This makes also the clang builds to failed.

Fixes: 0933bd04047c3b ("net: sparx5: Add support for ptp clocks")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
index fa377f6e7e08..cd110c31e5a4 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
@@ -32,7 +32,7 @@ static u64 sparx5_ptp_get_1ppm(struct sparx5 *sparx5)
 	 * (1/1000000)/((2^-59)/X)
 	 */
 
-	u64 res;
+	u64 res = 0;
 
 	switch (sparx5->coreclock) {
 	case SPX5_CORE_CLOCK_250MHZ:
@@ -54,7 +54,7 @@ static u64 sparx5_ptp_get_1ppm(struct sparx5 *sparx5)
 
 static u64 sparx5_ptp_get_nominal_value(struct sparx5 *sparx5)
 {
-	u64 res;
+	u64 res = 0;
 
 	switch (sparx5->coreclock) {
 	case SPX5_CORE_CLOCK_250MHZ:
-- 
2.33.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next] net: sparx5: Fix initialization of variables on stack
  2022-03-04 14:09 ` Horatiu Vultur
@ 2022-03-05  5:10   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-05  5:10 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: netdev, linux-arm-kernel, linux-kernel, llvm, davem, kuba,
	UNGLinuxDriver

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 4 Mar 2022 15:09:18 +0100 you wrote:
> The variables 'res' inside the functions sparx5_ptp_get_1ppm and
> sparx5_ptp_get_nominal_value was not initialized. So in case of the default
> case of the switch after, it would return an uninitialized variable.
> This makes also the clang builds to failed.
> 
> Fixes: 0933bd04047c3b ("net: sparx5: Add support for ptp clocks")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: sparx5: Fix initialization of variables on stack
    https://git.kernel.org/netdev/net-next/c/349fa2796e52

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net-next] net: sparx5: Fix initialization of variables on stack
@ 2022-03-05  5:10   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-05  5:10 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: netdev, linux-arm-kernel, linux-kernel, llvm, davem, kuba,
	UNGLinuxDriver

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 4 Mar 2022 15:09:18 +0100 you wrote:
> The variables 'res' inside the functions sparx5_ptp_get_1ppm and
> sparx5_ptp_get_nominal_value was not initialized. So in case of the default
> case of the switch after, it would return an uninitialized variable.
> This makes also the clang builds to failed.
> 
> Fixes: 0933bd04047c3b ("net: sparx5: Add support for ptp clocks")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: sparx5: Fix initialization of variables on stack
    https://git.kernel.org/netdev/net-next/c/349fa2796e52

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-03-05  5:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 14:09 [PATCH net-next] net: sparx5: Fix initialization of variables on stack Horatiu Vultur
2022-03-04 14:09 ` Horatiu Vultur
2022-03-05  5:10 ` patchwork-bot+netdevbpf
2022-03-05  5:10   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.