[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d2a0e2d-a72f-45f1-b9b6-c43c19a8fb16@kadam.mountain>
Date: Mon, 5 Jun 2023 18:10:45 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Simon Horman <horms@...nel.org>
Cc: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Jiawen Wu <jiawenwu@...stnetic.com>,
Mengyuan Lou <mengyuanlou@...-swift.com>,
Dan Carpenter <dan.carpenter@...aro.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: txgbe: Avoid passing uninitialised
parameter to pci_wake_from_d3()
On Mon, Jun 05, 2023 at 04:20:28PM +0200, Simon Horman wrote:
> txgbe_shutdown() relies on txgbe_dev_shutdown() to initialise
> wake by passing it by reference. However, txgbe_dev_shutdown()
> doesn't use this parameter at all.
>
> wake is then passed uninitialised by txgbe_dev_shutdown()
> to pci_wake_from_d3().
>
> Resolve this problem by:
> * Removing the unused parameter from txgbe_dev_shutdown()
> * Removing the uninitialised variable wake from txgbe_dev_shutdown()
> * Passing false to pci_wake_from_d3() - this assumes that
> although uninitialised wake was in practice false (0).
>
> I'm not sure that this counts as a bug, as I'm not sure that
> it manifests in any unwanted behaviour. But in any case, the issue
> was introduced by:
>
> bbd22f34b47c ("net: txgbe: Avoid passing uninitialised parameter to pci_wake_from_d3()")
>
> Flagged by Smatch as:
>
> .../txgbe_main.c:486 txgbe_shutdown() error: uninitialized symbol 'wake'.
>
> No functional change intended.
> Compile tested only.
>
Almost everyone turns on the AUTO_VAR_INIT stuff these days so that's
why we don't see these bugs in testing but they are still bugs and they
will affect people who have that turned off.
CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
# CONFIG_INIT_STACK_NONE is not set
CONFIG_INIT_STACK_ALL_PATTERN=y
# CONFIG_INIT_STACK_ALL_ZERO is not set
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
CONFIG_INIT_ON_FREE_DEFAULT_ON=y
I did report this bug, but I only sent it to the original author and I
CC'd kernel-janitors. In 2009 when Smatch was quite new the netdev list
was annoyed by static analysis bug reports so I stopped CCing netdev.
https://lore.kernel.org/all/YsWWXYal9ZwmIo2G@kili/
regards,
dan carpenter
Powered by blists - more mailing lists