lkml.org 
[lkml]   [2023]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] net: dsa: vsc73xxx: Fix uninitalized 'val' in vsc73xx_adjust_link
On Sun, Mar 12, 2023 at 03:50:08PM +0000, Danila Chernetsov wrote:
> Using uninitialized variable after calls vsc73xx_read
> without error checking may cause incorrect driver behavior.

I wonder if it is:
a) intentional that these calls are not checked for errors
b) errors can occur in these call paths

> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 95711cd5f0b4 ("net: dsa: vsc73xx: Split vsc73xx driver")
> Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
> ---
> drivers/net/dsa/vitesse-vsc73xx-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c
> index ae55167ce0a6..729005d6cb7e 100644
> --- a/drivers/net/dsa/vitesse-vsc73xx-core.c
> +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c
> @@ -758,7 +758,7 @@ static void vsc73xx_adjust_link(struct dsa_switch *ds, int port,
> struct phy_device *phydev)
> {
> struct vsc73xx *vsc = ds->priv;
> - u32 val;
> + u32 val = 0;
>
> /* Special handling of the CPU-facing port */
> if (port == CPU_PORT) {
> --
> 2.25.1
>

\
 
 \ /
  Last update: 2023-03-27 00:57    [W:0.249 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site