* [PATCH] tools/mfndump: Avoid deliberate NULL dereference
@ 2014-03-12 21:04 Andrew Cooper
2014-03-13 11:06 ` Ian Campbell
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2014-03-12 21:04 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Dario Faggioli, Ian Jackson, Ian Campbell
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@citrix.com>
Coverity-id: 1191885
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Dario Faggioli <dario.faggioli@citrix.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tools/mfndump: Avoid deliberate NULL dereference
2014-03-12 21:04 [PATCH] tools/mfndump: Avoid deliberate NULL dereference Andrew Cooper
@ 2014-03-13 11:06 ` Ian Campbell
2014-03-13 11:09 ` [PATCH v2] tools/mfndump: Avoid unintentional " Andrew Cooper
0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2014-03-13 11:06 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Dario Faggioli, Ian Jackson, Xen-devel
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@citrix.com>
> Coverity-id: 1191885
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Dario Faggioli <dario.faggioli@citrix.com>
>
> ---
>
> 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;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference
2014-03-13 11:06 ` Ian Campbell
@ 2014-03-13 11:09 ` Andrew Cooper
2014-03-13 12:53 ` Dario Faggioli
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2014-03-13 11:09 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Dario Faggioli, Ian Jackson
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@citrix.com>
Coverity-id: 1191885
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Dario Faggioli <dario.faggioli@citrix.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference
2014-03-13 11:09 ` [PATCH v2] tools/mfndump: Avoid unintentional " Andrew Cooper
@ 2014-03-13 12:53 ` Dario Faggioli
2014-03-13 18:04 ` Ian Jackson
0 siblings, 1 reply; 5+ messages in thread
From: Dario Faggioli @ 2014-03-13 12:53 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Ian Jackson, Xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 1072 bytes --]
On gio, 2014-03-13 at 11:09 +0000, Andrew Cooper wrote:
> 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@citrix.com>
> Coverity-id: 1191885
> Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Dario Faggioli <dario.faggioli@citrix.com>
>
If this is not yet in, feel free to add:
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
Because, I confirm, I did unintentionally and not deliberately! :-P
> 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
--
<<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)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference
2014-03-13 12:53 ` Dario Faggioli
@ 2014-03-13 18:04 ` Ian Jackson
0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2014-03-13 18:04 UTC (permalink / raw)
To: Dario Faggioli; +Cc: Andrew Cooper, Xen-devel
Dario Faggioli writes ("Re: [PATCH v2] tools/mfndump: Avoid unintentional NULL dereference"):
> On gio, 2014-03-13 at 11:09 +0000, Andrew Cooper wrote:
> > 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@citrix.com>
> > Coverity-id: 1191885
> > Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
> > CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> > CC: Dario Faggioli <dario.faggioli@citrix.com>
> >
> If this is not yet in, feel free to add:
>
> Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Thanks everyone.
Ian.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-13 18:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-12 21:04 [PATCH] tools/mfndump: Avoid deliberate NULL dereference Andrew Cooper
2014-03-13 11:06 ` Ian Campbell
2014-03-13 11:09 ` [PATCH v2] tools/mfndump: Avoid unintentional " Andrew Cooper
2014-03-13 12:53 ` Dario Faggioli
2014-03-13 18:04 ` Ian Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).