lkml.org 
[lkml]   [2016]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] MSR: fix badzero.cocci warnings
arch/x86/kernel/msr_whitelist.c:200:18-19: WARNING comparing pointer to 0
arch/x86/kernel/msr_whitelist.c:203:27-28: WARNING comparing pointer to 0

Compare pointer-typed values to NULL rather than 0

Semantic patch information:
This makes an effort to choose between !x and x == NULL. !x is used
if it has previously been used with the function used to initialize x.
This relies on type information. More type information can be obtained
using the option -all_includes and the option -I to specify an
include path.

Generated by: scripts/coccinelle/null/badzero.cocci

CC: Marty McFadden <mcfadden8@llnl.gov>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

msr_whitelist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/msr_whitelist.c
+++ b/arch/x86/kernel/msr_whitelist.c
@@ -197,10 +197,10 @@ static const struct file_operations fops

static void delete_whitelist(void)
{
- if (whitelist == 0)
+ if (whitelist == NULL)
return;

- if (whitelist->msrdata != 0)
+ if (whitelist->msrdata != NULL)
kfree(whitelist->msrdata);

kfree(whitelist);
\
 
 \ /
  Last update: 2016-02-26 02:41    [W:0.125 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site