[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/mfndump: Avoid deliberate NULL dereference



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 <andrew.cooper3@xxxxxxxxxx>
> Coverity-id: 1191885

Acked-by: Ian Campbell <Ian.Campbell@xxxxxxxxxx>

> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> 
> ---
> 
> 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;
>      }
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.