[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] ide: Adds "model=s" option, allowing the user t
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH] ide: Adds "model=s" option, allowing the user to override the default disk model name "QEMU HARDDISK" |
Date: |
Mon, 12 Mar 2012 12:38:49 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1 |
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<address@hidden> 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