mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/microcode/AMD: remove redundant null check on mc
@ 2017-03-15 17:10 Colin King
  2017-03-18  9:27 ` Borislav Petkov
  2017-03-18 11:37 ` [tip:x86/microcode] x86/microcode/AMD: Remove redundant NULL " tip-bot for Colin Ian King
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-03-15 17:10 UTC (permalink / raw)
  To: Borislav Petkov, Thomas Gleixner, Ingo Molnar, H . Peter Anvin, x86
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

mc is a pointer to the static u8 array amd_ucode_patch and
therefore can never be null, so the check is redundant. Remove it.

Detected by CoverityScan, CID#1372871 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 arch/x86/kernel/cpu/microcode/amd.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 7889ae4..f2afe99 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -352,9 +352,6 @@ void reload_ucode_amd(void)
 	u32 rev, dummy;
 
 	mc = (struct microcode_amd *)amd_ucode_patch;
-	if (!mc)
-		return;
-
 	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
 
 	if (rev < mc->hdr.patch_id) {
-- 
2.10.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/microcode/AMD: remove redundant null check on mc
  2017-03-15 17:10 [PATCH] x86/microcode/AMD: remove redundant null check on mc Colin King
@ 2017-03-18  9:27 ` Borislav Petkov
  2017-03-18 11:37 ` [tip:x86/microcode] x86/microcode/AMD: Remove redundant NULL " tip-bot for Colin Ian King
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2017-03-18  9:27 UTC (permalink / raw)
  To: Colin King
  Cc: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, x86,
	kernel-janitors, linux-kernel

On Wed, Mar 15, 2017 at 05:10:10PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> mc is a pointer to the static u8 array amd_ucode_patch and
> therefore can never be null, so the check is redundant. Remove it.
> 
> Detected by CoverityScan, CID#1372871 ("Logically Dead Code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  arch/x86/kernel/cpu/microcode/amd.c | 3 ---
>  1 file changed, 3 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:x86/microcode] x86/microcode/AMD: Remove redundant NULL check on mc
  2017-03-15 17:10 [PATCH] x86/microcode/AMD: remove redundant null check on mc Colin King
  2017-03-18  9:27 ` Borislav Petkov
@ 2017-03-18 11:37 ` tip-bot for Colin Ian King
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Colin Ian King @ 2017-03-18 11:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, x86, mingo, bp, colin.king, hpa, linux-kernel

Commit-ID:  cf8178f78645148dc38b28263b9d3f604148e3a8
Gitweb:     http://git.kernel.org/tip/cf8178f78645148dc38b28263b9d3f604148e3a8
Author:     Colin Ian King <colin.king@canonical.com>
AuthorDate: Wed, 15 Mar 2017 17:10:10 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 18 Mar 2017 12:31:58 +0100

x86/microcode/AMD: Remove redundant NULL check on mc

mc is a pointer to the static u8 array amd_ucode_patch and
therefore can never be null, so the check is redundant. Remove it.

Detected by CoverityScan, CID#1372871 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: kernel-janitors@vger.kernel.org
Cc: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/20170315171010.17536-1-colin.king@canonical.com
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/cpu/microcode/amd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 7889ae4..1d38e53 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -352,8 +352,6 @@ void reload_ucode_amd(void)
 	u32 rev, dummy;
 
 	mc = (struct microcode_amd *)amd_ucode_patch;
-	if (!mc)
-		return;
 
 	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-18 15:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15 17:10 [PATCH] x86/microcode/AMD: remove redundant null check on mc Colin King
2017-03-18  9:27 ` Borislav Petkov
2017-03-18 11:37 ` [tip:x86/microcode] x86/microcode/AMD: Remove redundant NULL " tip-bot for Colin Ian King

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®