From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S73XK-0004NU-3K for qemu-devel@nongnu.org; Mon, 12 Mar 2012 07:35:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S73XA-0007Ss-51 for qemu-devel@nongnu.org; Mon, 12 Mar 2012 07:35:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S73X9-0007Sh-T3 for qemu-devel@nongnu.org; Mon, 12 Mar 2012 07:35:24 -0400 Message-ID: <4F5DE049.7070208@redhat.com> Date: Mon, 12 Mar 2012 12:38:49 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1331409387-18234-1-git-send-email-bos@je-eigen-domein.nl> <4F5DDE65.3060400@je-eigen-domein.nl> In-Reply-To: <4F5DDE65.3060400@je-eigen-domein.nl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] ide: Adds "model=s" option, allowing the user to override the default disk model name "QEMU HARDDISK" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Floris Bos / Maxnet Cc: Stefan Hajnoczi , qemu-devel@nongnu.org Am 12.03.2012 12:30, schrieb Floris Bos / Maxnet: > On 03/12/2012 11:26 AM, Stefan Hajnoczi wrote: >> On Sat, Mar 10, 2012 at 7:56 PM, Floris Bos wrote: >>> @@ -1885,6 +1885,22 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind, >>> snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), >>> "QM%05d", s->drive_serial); >>> } >>> + if (model) { >>> + strncpy(s->drive_model_str, model, sizeof(s->drive_model_str)); >> strncpy(3) does not NUL-terminate if the max length is reached. >> Either you need to use pstrcpy() or specify sizeof(s->drive_model_str) >> - 1 and make sure s->drive_model_str[40] = '\0'. > > Thanks for the feedback. > > Will change that line (and serial that used strncpy() as well) to > pstrcpy(), correct the cosmetic issues mentioned by Andreas and submit a > v2 patch. Fixing serial as well is a good idea. Please submit a separate patch for that, though, as it is an independent fix. Kevin