lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a6f9a5aa-3208-7d03-93a0-768fd0805fdc@linux.intel.com>
Date: Tue, 29 Oct 2024 14:39:41 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Arnd Bergmann <arnd@...nel.org>
cc: Arnd Bergmann <arnd@...db.de>, Thomas Gleixner <tglx@...utronix.de>, 
    Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, 
    Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, 
    "H. Peter Anvin" <hpa@...or.com>, 
    Mario Limonciello <mario.limonciello@....com>, 
    Bjorn Helgaas <bhelgaas@...gle.com>, Yazen Ghannam <yazen.ghannam@....com>, 
    Suma Hegde <suma.hegde@....com>, 
    Naveen Krishna Chatradhi <naveenkrishna.chatradhi@....com>, 
    LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] platform/x86/amd/hsmp: fix compile-testing without
 CONFiG_AMD_NB

On Tue, 29 Oct 2024, Arnd Bergmann wrote:

> From: Arnd Bergmann <arnd@...db.de>
> 
> node_to_amd_nb() is defined to NULL in non-AMD configs:
> 
> drivers/platform/x86/amd/hsmp/plat.c: In function 'init_platform_device':
> drivers/platform/x86/amd/hsmp/plat.c:165:68: error: dereferencing 'void *' pointer [-Werror]
>   165 |                 sock->root                      = node_to_amd_nb(i)->root;
>       |                                                                    ^~
> drivers/platform/x86/amd/hsmp/plat.c:165:68: error: request for member 'root' in something not a structure or union
> 
> Change the definition to something that builds. This does introduce a
> NULL pointer dereference but the code is never called since the driver
> won't probe successfully.

I don't like this very wording because what the code very much does is 
NULL check on node_to_amd_nb() which leads to immediate failure of 
.probe(). (We don't call other deferences after a NULL check "NULL pointer 
dereference" either so none is introduced by this patch, IMO.)

With that fixed,

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

-- 
 i.

> Fixes: 7d3135d16356 ("platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  arch/x86/include/asm/amd_nb.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h
> index 6f3b6aef47ba..d0caac26533f 100644
> --- a/arch/x86/include/asm/amd_nb.h
> +++ b/arch/x86/include/asm/amd_nb.h
> @@ -116,7 +116,10 @@ static inline bool amd_gart_present(void)
>  
>  #define amd_nb_num(x)		0
>  #define amd_nb_has_feature(x)	false
> -#define node_to_amd_nb(x)	NULL
> +static inline struct amd_northbridge *node_to_amd_nb(int node)
> +{
> +	return NULL;
> +}
>  #define amd_gart_present(x)	false
>  
>  #endif
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ