tools/mfndump: Avoid deliberate NULL dereference
PATCH 1/1 tools/mfndump: Avoid deliberate NULL dereference
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.
Coverity-id: 1191885
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Dario Faggioli <[email protected]>
---
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(-)
tools/misc/xen-mfndump.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.10.4
On Wed, 2014-03-12 at 21:04 +0000, Andrew Cooper wrote:
"deliberate" doesn't seem likely. "unintentional" is more plausible
Quoted 5 lines
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 <[email protected]>Coverity-id: 1191885
Quoted 24 lines
CC Ian Jackson <[email protected]>CC Dario Faggioli <[email protected]>---
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(-)tools/misc/xen-mfndump.c +1
-1@@ -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 ; }
PATCH v2 1/1 tools/mfndump: Avoid unintentional NULL dereference
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.
Coverity-id: 1191885
---
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(-)
tools/misc/xen-mfndump.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.10.4
Re: [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference
Quoted 9 lines · Andrew Cooper
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 <[email protected]>Coverity-id: 1191885
Acked-by Ian Campbell <[email protected]>CC Ian Jackson <[email protected]>CC Dario Faggioli <[email protected]>
If this is not yet in, feel free to add:
Because, I confirm, I did unintentionally and not deliberately! :-P
Quoted 5 lines
v2: Reword subject
This is why macros depending on variables in scope, particularly ones named as simily as "ERROR", are evil.
I Could not agree more!
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference
Dario Faggioli writes ("Re: [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference"):
Quoted 10 lines · Andrew Cooper
Quoted 9 lines
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 <[email protected]>Coverity-id: 1191885
Acked-by Ian Campbell <[email protected]>CC Ian Jackson <[email protected]>CC Dario Faggioli <[email protected]>
Quoted 3 lines
If this is not yet in, feel free to add:
Acked-by Dario Faggioli <[email protected]>
Thanks everyone.
Ian.