All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 3/5] x86/ucode: Don't try to cope with NULL pointers in apply_microcode()
Date: Thu, 2 Apr 2020 11:19:00 +0100	[thread overview]
Message-ID: <20200402101902.28234-4-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20200402101902.28234-1-andrew.cooper3@citrix.com>

No paths to apply_microcode() pass a NULL pointer, and other hooks don't
tolerate one in the first place.  We can expect the core logic not to pass us
junk, so drop the checks.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/microcode/amd.c   | 3 ---
 xen/arch/x86/cpu/microcode/intel.c | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index c9656de55d..0ca0e9a038 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -219,9 +219,6 @@ static int apply_microcode(const struct microcode_patch *patch)
     struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
     uint32_t rev, old_rev = sig->rev;
 
-    if ( !patch )
-        return -ENOENT;
-
     if ( microcode_fits(patch) != NEW_UCODE )
         return -EINVAL;
 
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index 315fca9ff2..9cb077b583 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -270,9 +270,6 @@ static int apply_microcode(const struct microcode_patch *patch)
     struct cpu_signature *sig = &this_cpu(cpu_sig);
     uint32_t rev, old_rev = sig->rev;
 
-    if ( !patch )
-        return -ENOENT;
-
     if ( microcode_update_match(patch) != NEW_UCODE )
         return -EINVAL;
 
-- 
2.11.0



  parent reply	other threads:[~2020-04-02 10:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-02 10:18 [PATCH 0/5] x86/ucode: Cleanup part 5/n Andrew Cooper
2020-04-02 10:18 ` [PATCH 1/5] x86/ucode/intel: Remove CPUID from collect_cpu_info() Andrew Cooper
2020-04-03 13:36   ` Jan Beulich
2020-04-02 10:18 ` [PATCH 2/5] x86/ucode: Drop ops->match_cpu() Andrew Cooper
2020-04-03 13:38   ` Jan Beulich
2020-04-02 10:19 ` Andrew Cooper [this message]
2020-04-03 13:42   ` [PATCH 3/5] x86/ucode: Don't try to cope with NULL pointers in apply_microcode() Jan Beulich
2020-04-02 10:19 ` [PATCH 4/5] x86/ucode: Drop ops->free_patch() Andrew Cooper
2020-04-03 13:44   ` Jan Beulich
2020-04-02 10:19 ` [PATCH 5/5] x86/ucode: Simplify the ops->collect_cpu_info() API Andrew Cooper
2020-04-03 13:46   ` Jan Beulich

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=20200402101902.28234-4-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 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.