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 16:44:35 +0200 Message-ID: <20120402144435.GD4000@aepfle.de> References: <1c86e2e5268d14587c73.1333095918@probook.site> <20345.44502.306179.202932@mariner.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: <20345.44502.306179.202932@mariner.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 Jackson Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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. Olaf