Roger Pau Monné
2011-Jul-14 11:56 UTC
[Xen-devel] [PATCH] xenbackendd: clean variable in loop
Fixed a cleanup of a variable used in a loop that was giving error messages, and added a debug message. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Jul-14 16:36 UTC
Re: [Xen-devel] [PATCH] xenbackendd: clean variable in loop
Roger Pau Monné writes ("[Xen-devel] [PATCH] xenbackendd: clean variable in
loop"):> Fixed a cleanup of a variable used in a loop that was giving error
> messages, and added a debug message.
Thanks, but I''m not entirely clear about the bug you think this is
fixing.
Looking at the existing code it seems like the problem is that if the
loop is repeated and the 2nd device isn''t a vbd or a vif, the previous
type is erroneously reused.
I think this woudl be better fixed by moving the initialisation of
type from the top of the function to just before it might first be
set.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Jul-14 17:21 UTC
Re: [Xen-devel] [PATCH] xenbackendd: clean variable in loop
The problem is that console usually comes after vbd, and it executes the block hotplug script with the console device (because ''type'' is still set from the previous loop), nothing bad happens, just wanted to get rid of the error message. Since the variable is reused trough the for loop, I think it''s best to clean it at the start/end of the loop, this makes the code easier to understand (for me). Where do you exactly suggest to put the initialization? Thanks, Roger. 2011/7/14 Ian Jackson <Ian.Jackson@eu.citrix.com>:> Roger Pau Monné writes ("[Xen-devel] [PATCH] xenbackendd: clean variable in loop"): >> Fixed a cleanup of a variable used in a loop that was giving error >> messages, and added a debug message. > > Thanks, but I''m not entirely clear about the bug you think this is > fixing. > > Looking at the existing code it seems like the problem is that if the > loop is repeated and the 2nd device isn''t a vbd or a vif, the previous > type is erroneously reused. > > I think this woudl be better fixed by moving the initialisation of > type from the top of the function to just before it might first be > set. > > Ian. >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Jul-14 17:35 UTC
Re: [Xen-devel] [PATCH] xenbackendd: clean variable in loop
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] xenbackendd: clean
variable in loop"):> The problem is that console usually comes after vbd, and it executes
> the block hotplug script with the console device (because
''type'' is
> still set from the previous loop), nothing bad happens, just wanted to
> get rid of the error message. Since the variable is reused trough the
> for loop, I think it''s best to clean it at the start/end of the
loop,
> this makes the code easier to understand (for me). Where do you
> exactly suggest to put the initialization?
I would delete the initialisation (but not the whole declaration) from
line 155 and add it near line 274. If this produces a compiler
warning about possible uninitialised use then we have missed
something.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Jul-15 07:28 UTC
Re: [Xen-devel] [PATCH] xenbackendd: clean variable in loop
Hello, Here is the modified patch. 2011/7/14 Ian Jackson <Ian.Jackson@eu.citrix.com>:> Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] xenbackendd: clean variable in loop"): >> The problem is that console usually comes after vbd, and it executes >> the block hotplug script with the console device (because ''type'' is >> still set from the previous loop), nothing bad happens, just wanted to >> get rid of the error message. Since the variable is reused trough the >> for loop, I think it''s best to clean it at the start/end of the loop, >> this makes the code easier to understand (for me). Where do you >> exactly suggest to put the initialization? > > I would delete the initialisation (but not the whole declaration) from > line 155 and add it near line 274. If this produces a compiler > warning about possible uninitialised use then we have missed > something. > > Ian. >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Jul-15 17:10 UTC
Re: [Xen-devel] [PATCH] xenbackendd: clean variable in loop
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] xenbackendd: clean
variable in loop"):> Here is the modified patch.
Thanks.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel