From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference Date: Thu, 13 Mar 2014 11:09:07 +0000 Message-ID: <1394708947-29113-1-git-send-email-andrew.cooper3@citrix.com> References: <1394708774.25873.45.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1394708774.25873.45.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Dario Faggioli , Ian Jackson List-Id: xen-devel@lists.xenproject.org If we failed to open an xc interface, using xch to log an error will end in tears. Print to stderr instead, as we are bailing immediately later. Signed-off-by: Andrew Cooper Coverity-id: 1191885 Acked-by: Ian Campbell CC: Ian Jackson CC: Dario Faggioli --- v2: Reword subject This is why macros depending on variables in scope, particularly ones named as simily as "ERROR", are evil. --- tools/misc/xen-mfndump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/misc/xen-mfndump.c b/tools/misc/xen-mfndump.c index 8064527..e1ea536 100644 --- a/tools/misc/xen-mfndump.c +++ b/tools/misc/xen-mfndump.c @@ -400,7 +400,7 @@ int main(int argc, char *argv[]) xch = xc_interface_open(0, 0, 0); if ( !xch ) { - ERROR("Failed to open an xc handler"); + fprintf(stderr, "Failed to open an xc handler"); return 1; } -- 1.7.10.4