From: Ian Campbell Subject: Re: [PATCH] tools/mfndump: Avoid deliberate NULL dereference Date: Thu, 13 Mar 2014 11:06:14 +0000 Message-ID: <1394708774.25873.45.camel@kazak.uk.xensource.com> References: <1394658246-10531-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1394658246-10531-1-git-send-email-andrew.cooper3@citrix.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: Andrew Cooper Cc: Dario Faggioli , Ian Jackson , Xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2014-03-12 at 21:04 +0000, Andrew Cooper wrote: "deliberate" doesn't seem likely. "unintentional" is more plausible > 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 > > --- > > 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; > } >