X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Suma Hegde <suma.hegde@amd.com>
Cc: platform-driver-x86@vger.kernel.org, hdegoede@redhat.com,
	 Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>,
	 NaveenKrishna.Chatradhi@amd.com,
	 Muthusamy Ramalingam <Muthusamy.Ramalingam@amd.com>
Subject: Re: [PATCH 03/11] platform/x86/amd/hsmp: Null-check drvdata in hsmp_is_sock_attr_visible()
Date: Wed, 21 Oct 2026 14:07:19 +0300 (EEST)	[thread overview]
Message-ID: <f46416a5-2ffc-c530-6f5e-4eee9ae97ff4@linux.intel.com> (raw)
In-Reply-To: <3cc4005d44f633a427eb3861be8094999ce9e71e.1791446401.git.Suma.Hegde@amd.com>

On Thu, 8 Oct 2026, Suma Hegde wrote:

> From: Suma Hegde <Suma.Hegde@amd.com>
> 
> dev_get_drvdata() can return NULL if probe failed before setting the
> socket pointer. Check for that before reading sock->proto_ver so the
> sysfs visibility callback cannot NULL-dereference.
> 
> Co-developed-by: Muthusamy Ramalingam <Muthusamy.Ramalingam@amd.com>
> Signed-off-by: Muthusamy Ramalingam <Muthusamy.Ramalingam@amd.com>
> Signed-off-by: Suma Hegde <Suma.Hegde@amd.com>
> ---
>  drivers/platform/x86/amd/hsmp/acpi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
> index 088c44ea1782e..0e412c23c69c8 100644
> --- a/drivers/platform/x86/amd/hsmp/acpi.c
> +++ b/drivers/platform/x86/amd/hsmp/acpi.c
> @@ -306,6 +306,9 @@ static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
>  	struct device *dev = kobj_to_dev(kobj);
>  	struct hsmp_socket *sock = dev_get_drvdata(dev);
>  
> +	if (!sock)

Please put call and it's error handling next to each other, effectively 
that means moving sock assignment out of the local variable block.

> +		return 0;
> +
>  	if (!is_client_platform() && sock->proto_ver >= HSMP_PROTO_VER6)
>  		return battr->attr.mode;
>  
> 

-- 
 i.


  reply	other threads:[~2026-10-21 11:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  9:29 [PATCH 00/11] platform/x86/amd/hsmp: Per-platform enabled-message bitmaps Suma Hegde
2026-10-08  9:29 ` [PATCH 01/11] platform/x86/amd/hsmp: Fix sock_ind bounds check in is_bin_visible Suma Hegde
2026-10-08  9:29 ` [PATCH 02/11] platform/x86/amd/hsmp: Move proto_ver to hsmp_socket structure Suma Hegde
2026-10-08  9:29 ` [PATCH 03/11] platform/x86/amd/hsmp: Null-check drvdata in hsmp_is_sock_attr_visible() Suma Hegde
2026-10-21 11:07   ` Ilpo Järvinen [this message]
2026-10-08  9:29 ` [PATCH 04/11] platform/x86/amd/hsmp: Move is_get_msg() before validate_message() Suma Hegde
2026-10-08  9:29 ` [PATCH 05/11] platform/x86/amd/hsmp: Use local sock pointer in init_acpi() Suma Hegde
2026-10-08  9:29 ` [PATCH 06/11] platform/x86/amd/hsmp: Move the sock_ind bound check before validate_message() Suma Hegde
2026-10-08  9:29 ` [PATCH 07/11] platform/x86/amd/hsmp: Add per-platform bitmap to validate HSMP messages Suma Hegde
2026-10-21 11:25   ` Ilpo Järvinen
2026-10-21 11:28     ` Ilpo Järvinen
2026-10-08  9:29 ` [PATCH 08/11] platform/x86/amd/hsmp: Populate the bitmaps dynamically on 6th Gen AMD EPYC Server Suma Hegde
2026-10-08  9:29 ` [PATCH 09/11] platform/x86/amd/hsmp: Populate the bitmaps dynamically for future platforms Suma Hegde
2026-10-08  9:29 ` [PATCH 10/11] platform/x86/amd/hsmp: Relocate to_hsmp_sys_attr() macro Suma Hegde
2026-10-08  9:29 ` [PATCH 11/11] platform/x86/amd/hsmp: Update sysfs and hwmon file modes based on platform capabilities Suma Hegde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f46416a5-2ffc-c530-6f5e-4eee9ae97ff4@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=NaveenKrishna.Chatradhi@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=muthusamy.ramalingam@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=suma.hegde@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox