All of lore.kernel.org
 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,
	Hans de Goede <hdegoede@redhat.com>,
	 Naveen Krishna Chatradhi <nchatrad@amd.com>
Subject: Re: [PATCH v4 8/9] platform/x86/amd/hsmp: Check num_sockets against MAX_AMD_SOCKETS
Date: Fri, 5 Jan 2024 11:36:44 +0200 (EET)	[thread overview]
Message-ID: <c72d58c-d8d2-9470-e59e-7e533fc25a0@linux.intel.com> (raw)
In-Reply-To: <20240105074618.1667898-9-suma.hegde@amd.com>

[-- Attachment #1: Type: text/plain, Size: 1755 bytes --]

On Fri, 5 Jan 2024, Suma Hegde wrote:

> AMD supports connecting up to 8 AMD EPYCs in a system.
> Hence, verify the num_sockets returned from amd_nb_num().
> Also remove the WARN_ON() since the num_sockets is already verified.
> 
> Signed-off-by: Suma Hegde <suma.hegde@amd.com>
> Reviewed-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
> ---
> Changes since v3:
> New patch
> 
>  drivers/platform/x86/amd/hsmp.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c
> index 05255102e0a0..99bebb0ca5a9 100644
> --- a/drivers/platform/x86/amd/hsmp.c
> +++ b/drivers/platform/x86/amd/hsmp.c
> @@ -62,6 +62,8 @@
>  #define MSG_ARGOFF_STR		"MsgArgOffset"
>  #define MSG_RESPOFF_STR		"MsgRspOffset"
>  
> +#define MAX_AMD_SOCKETS 8
> +
>  struct hsmp_mbaddr_info {
>  	u32 base_addr;
>  	u32 msg_id_off;
> @@ -671,10 +673,6 @@ static int hsmp_create_non_acpi_sysfs_if(struct device *dev)
>  	struct attribute_group *attr_grp;
>  	u16 i;
>  
> -	/* String formatting is currently limited to u8 sockets */
> -	if (WARN_ON(plat_dev.num_sockets > U8_MAX))
> -		return -ERANGE;
> -
>  	hsmp_attr_grps = devm_kzalloc(dev, sizeof(struct attribute_group *) *
>  				      (plat_dev.num_sockets + 1), GFP_KERNEL);
>  	if (!hsmp_attr_grps)
> @@ -925,7 +923,7 @@ static int __init hsmp_plt_init(void)
>  	 * if we have N SMN/DF interfaces that ideally means N sockets
>  	 */
>  	plat_dev.num_sockets = amd_nb_num();
> -	if (plat_dev.num_sockets == 0)
> +	if (plat_dev.num_sockets == 0 || plat_dev.num_sockets > MAX_AMD_SOCKETS)
>  		return ret;
>  
>  	ret = platform_driver_register(&amd_hsmp_driver);
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

  reply	other threads:[~2024-01-05  9:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05  7:46 [PATCH v4 0/9] Add ACPI probing support for HSMP Suma Hegde
2024-01-05  7:46 ` [PATCH v4 1/9] platform/x86/amd/hsmp: Move hsmp_test to probe Suma Hegde
2024-01-05  7:46 ` [PATCH v4 2/9] platform/x86/amd/hsmp: Cache pci_dev in struct hsmp_socket Suma Hegde
2024-01-05  7:46 ` [PATCH v4 3/9] platform/x86/amd/hsmp: Create static func to handle platdev Suma Hegde
2024-01-05  7:46 ` [PATCH v4 4/9] platform/x86/amd/hsmp: Define a struct to hold mailbox regs Suma Hegde
2024-01-05  7:46 ` [PATCH v4 5/9] platform/x86/amd/hsmp: Move dev from platdev to hsmp_socket Suma Hegde
2024-01-05  7:46 ` [PATCH v4 6/9] platform/x86/amd/hsmp: Add support for ACPI based probing Suma Hegde
2024-01-05  9:31   ` Ilpo Järvinen
2024-01-06  2:11     ` Hegde, Suma
2024-01-05  7:46 ` [PATCH v4 7/9] platform/x86/amd/hsmp: Non-ACPI support for AMD F1A_M00~0Fh Suma Hegde
2024-01-05  7:46 ` [PATCH v4 8/9] platform/x86/amd/hsmp: Check num_sockets against MAX_AMD_SOCKETS Suma Hegde
2024-01-05  9:36   ` Ilpo Järvinen [this message]
2024-01-05  7:46 ` [PATCH v4 9/9] platform/x86/amd/hsmp: Change devm_kzalloc() to devm_kcalloc() Suma Hegde
2024-01-05  9:37   ` Ilpo Järvinen

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=c72d58c-d8d2-9470-e59e-7e533fc25a0@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=nchatrad@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.