Re: [PATCH][next] staging: qlge: fix read of an uninitialized pointer

Coiby Xu
2021-02-03T13:51:31Z

On Wed, Feb 03, 2021 at 01:38:34PM +0000, Colin King wrote:
>From: Colin Ian King <colin.king@canonical.com>
>
>Currently the pointer 'reporter' is not being initialized and is
>being read in a netdev_warn message. The pointer is not used
>and is redundant, fix this by removing it and replacing the reference
>to it with priv->reporter instead.
>
>Addresses-Coverity: ("Uninitialized pointer read")
>Fixes: 1053c27804df ("staging: qlge: coredump via devlink health reporter")
>Signed-off-by: Colin Ian King <colin.king@canonical.com>
>---
> drivers/staging/qlge/qlge_devlink.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/staging/qlge/qlge_devlink.c b/drivers/staging/qlge/qlge_devlink.c
>index c6ef5163e241..86834d96cebf 100644
>--- a/drivers/staging/qlge/qlge_devlink.c
>+++ b/drivers/staging/qlge/qlge_devlink.c
>@@ -150,7 +150,6 @@ static const struct devlink_health_reporter_ops qlge_reporter_ops = {
>
> void qlge_health_create_reporters(struct qlge_adapter *priv)
> {
>- struct devlink_health_reporter *reporter;
> struct devlink *devlink;
>
> devlink = priv_to_devlink(priv);
>@@ -160,5 +159,5 @@ void qlge_health_create_reporters(struct qlge_adapter *priv)
> if (IS_ERR(priv->reporter))
> netdev_warn(priv->ndev,
> "Failed to create reporter, err = %ld\n",
>- PTR_ERR(reporter));
>+ PTR_ERR(priv->reporter));
> }
>--
>2.29.2
>

Thanks for fixing this issue.

Reviewed-by: Coiby Xu <coiby.xu@gmail.com>

--
Best regards,
Coiby