From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: [PATCH 01 of 18] tools/blktap: fix access errors in convert_dev_name_to_num Date: Mon, 2 Apr 2012 17:08:29 +0200 Message-ID: <20120402150829.GA5043@aepfle.de> References: <1c86e2e5268d14587c73.1333095918@probook.site> <20345.44502.306179.202932@mariner.uk.xensource.com> <20120402144435.GD4000@aepfle.de> <1333379043.25602.85.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1333379043.25602.85.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xensource.com" , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Mon, Apr 02, Ian Campbell wrote: > 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. static is not needed, you are right. I will split that patch. Olaf