|
[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
Ian Campbell writes ("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"):
...
> > > > - 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.
Right. But I don't object to it, if it is properly described in the
commit message.
> Adding the const seems reasonable enough. Not sure what the static buys
> you on top of that.
Changing from
const char *str = "foo";
to
const char str[] = "foo";
prevents erroneous code from modifying str.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |