mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Michael Roth <michael.roth@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>,
	Borislav Petkov <bp@suse.de>,
	x86@kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: potential null pointer dereference in setup_cpuid_table
Date: Thu, 27 Jul 2023 15:22:42 +0100	[thread overview]
Message-ID: <0012c64a-26cb-131d-7abb-29f6741af944@gmail.com> (raw)

Hi,

Static analysis with cppcheck found a potential null pointer dereference 
in function setup_cpuid_table in arch/x86/kernel/sev-shared.c as follows:

         if (!cc_info || !cc_info->cpuid_phys || cc_info->cpuid_len < 
PAGE_SIZE)
                 sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_CPUID);

         cpuid_table_fw = (const struct snp_cpuid_table 
*)cc_info->cpuid_phys;


cc_info is being null checked, so it's potentially null, however, the 
assignment to cpuid_table_fw is dereferencing cc_info. Either cc_info is 
never null and the null check is redundant, or there is a potential null 
pointer dereference.

Colin


             reply	other threads:[~2023-07-27 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 14:22 Colin King (gmail) [this message]
2023-08-07 20:57 ` Borislav Petkov

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=0012c64a-26cb-131d-7abb-29f6741af944@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=bp@suse.de \
    --cc=brijesh.singh@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®