From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: Re: [PATCH] libxl: compile fix Date: Wed, 28 Jul 2010 15:03:46 +0200 Message-ID: <201007281503.46979.Christoph.Egger@amd.com> References: <201007201831.21416.Christoph.Egger@amd.com> <201007281342.25751.Christoph.Egger@amd.com> <1280319757.24292.122.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1280319757.24292.122.camel@zakaz.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: "xen-devel@lists.xensource.com" , Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wednesday 28 July 2010 14:22:37 Ian Campbell wrote: > On Wed, 2010-07-28 at 12:42 +0100, Christoph Egger wrote: > > Hi! > > > > Attached patch fixes this compile error: > > > > xl_cmdimpl.c: In function 'create_domain': > > xl_cmdimpl.c:1099: warning: 'action' may be used uninitialized in this > > function > > Thanks. > > This can't actually happen in practice today since the switch statement > covers all of the possible values of info->shutdown_reason. (in a > previous version of the series which introduced this code > shutdown_reason was an enum so the compiler knew this). > > However to be robust it is probably worth adding a default: case to the > switch and logging the unknown shutdown code. > > Ian. > > > Subject: xl: log unknown domain shutdown reason and default to destroy > > Signed-off-by: Ian Campbell > > diff -r 479d042f25e4 tools/libxl/xl_cmdimpl.c > --- a/tools/libxl/xl_cmdimpl.c Wed Jul 28 12:07:44 2010 +0100 > +++ b/tools/libxl/xl_cmdimpl.c Wed Jul 28 13:21:16 2010 +0100 > @@ -1113,6 +1113,9 @@ static int handle_domain_death(libxl_ctx > case SHUTDOWN_watchdog: > action = d_config->on_watchdog; > break; > + default: > + LOG("Unknown shutdown reason code %s. Destroying domain.", > info->shutdown_reason); + action = ACTION_DESTROY; > } > > LOG("Action for shutdown reason code %d is %s", info->shutdown_reason, > action_on_shutdown_names[action]); > Acked-by: Christoph Egger -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632