[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<BN9PR12MB53813701D8E50C8370C7C387AF212@BN9PR12MB5381.namprd12.prod.outlook.com>
Date: Wed, 6 Mar 2024 16:01:10 +0000
From: Vadim Pasternak <vadimp@...dia.com>
To: Daniil Dulov <d.dulov@...ddin.ru>
CC: Mark Gross <mgross@...ux.intel.com>, Andy Shevchenko <andy@...radead.org>,
Darren Hart <dvhart@...radead.org>, Hans de Goede <hdegoede@...hat.com>,
"platform-driver-x86@...r.kernel.org" <platform-driver-x86@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lvc-project@...uxtesting.org" <lvc-project@...uxtesting.org>
Subject: RE: [PATCH] platform/mellanox: mlxreg-hotplug: Remove redundant
NULL-check
> -----Original Message-----
> From: Daniil Dulov <d.dulov@...ddin.ru>
> Sent: Wednesday, 6 March 2024 17:38
> To: Vadim Pasternak <vadimp@...dia.com>
> Cc: Daniil Dulov <d.dulov@...ddin.ru>; Mark Gross
> <mgross@...ux.intel.com>; Andy Shevchenko <andy@...radead.org>; Darren
> Hart <dvhart@...radead.org>; Hans de Goede <hdegoede@...hat.com>;
> platform-driver-x86@...r.kernel.org; linux-kernel@...r.kernel.org; lvc-
> project@...uxtesting.org
> Subject: [PATCH] platform/mellanox: mlxreg-hotplug: Remove redundant
> NULL-check
>
> Pointer item is checked fo NULL at mlxreg_hotplug_work_helper() and then it
> is dereferenced to produce dev_err().
> This pointer is also dereferenced before calling this function and should never
> be NULL except some piece of hardware is broken as it is said in the comment
> before the check. So, this check can be safely removed.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: c6acad68eb2d ("platform/mellanox: mlxreg-hotplug: Modify to use a
> regmap interface")
> Signed-off-by: Daniil Dulov <d.dulov@...ddin.ru>
Reviewed-by: Vadim Pasternak <vadimp@...dia.com>
> ---
> drivers/platform/mellanox/mlxreg-hotplug.c | 14 --------------
> 1 file changed, 14 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c
> b/drivers/platform/mellanox/mlxreg-hotplug.c
> index 5c022b258f91..0ce9fff1f7d4 100644
> --- a/drivers/platform/mellanox/mlxreg-hotplug.c
> +++ b/drivers/platform/mellanox/mlxreg-hotplug.c
> @@ -348,20 +348,6 @@ mlxreg_hotplug_work_helper(struct
> mlxreg_hotplug_priv_data *priv,
> u32 regval, bit;
> int ret;
>
> - /*
> - * Validate if item related to received signal type is valid.
> - * It should never happen, excepted the situation when some
> - * piece of hardware is broken. In such situation just produce
> - * error message and return. Caller must continue to handle the
> - * signals from other devices if any.
> - */
> - if (unlikely(!item)) {
> - dev_err(priv->dev, "False signal: at offset:mask
> 0x%02x:0x%02x.\n",
> - item->reg, item->mask);
> -
> - return;
> - }
> -
> /* Mask event. */
> ret = regmap_write(priv->regmap, item->reg +
> MLXREG_HOTPLUG_MASK_OFF,
> 0);
> --
> 2.25.1
Powered by blists - more mailing lists