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

Re: [Xen-devel] [PATCH 01 of 18] tools/blktap: fix access errors in convert_dev_name_to_num



On Mon, 2012-04-02 at 15:44 +0100, Olaf Hering wrote:
> On Mon, Apr 02, Ian Jackson wrote:
> 
> > Olaf Hering writes ("[Xen-devel] [PATCH 01 of 18] tools/blktap: fix access 
> > errors in convert_dev_name_to_num"):
> > > xs_api.c: In function 'convert_dev_name_to_num':
> > ...
> > > ptr should be increased in each iteration, not the char it points to.
> > 
> > These changes from `*p++;' to `p++' are correct.  But the description
> > is wrong.  `*p++' is the same as `*(p++)' ie it increments p and then
> > uselessly dereferences it.
> > 
> > > - char *p_sd = "/dev/sd";
> > > - char *p_hd = "/dev/hd";
> > > - char *p_xvd = "/dev/xvd";
> > > - char *p_plx = "plx";
> > > - char *alpha = "abcdefghijklmnop";
> > > + static const char p_sd[] = "/dev/sd";
> > > + static const char p_hd[] = "/dev/hd";
> > > + static const char p_xvd[] = "/dev/xvd";
> > > + static const char p_plx[] = "plx";
> > > + static const char alpha[] = "abcdefghijklmnop";
> > 
> > And this hunk seems entirely unexplained.  Is it supposed to be a
> > const-correctness fix ?  Stylistic improvement ?
> 
> I think that part is not strictly needed.

Adding the const seems reasonable enough. Not sure what the static buys
you on top of that.

Ian.



_______________________________________________
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®.