RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 688058 - Drive serial number gets truncated
Summary: Drive serial number gets truncated
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: jason wang
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-16 07:30 UTC by Markus Armbruster
Modified: 2017-02-06 14:36 UTC (History)
6 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.153.el6
Doc Type: Bug Fix
Doc Text:
Cause: bug in the serial number setting code inside qemu-kvm. Consequence: drive serial number got truncated to 8 characters. Fix: Fix serial number assignment code. Result: drive serial number not truncated anymore.
Clone Of:
Environment:
Last Closed: 2011-05-19 11:21:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0534 0 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2011-05-19 11:20:36 UTC

Description Markus Armbruster 2011-03-16 07:30:47 UTC
Description of problem:
The serial number defined with -drive is truncated to sizeof(char *) characters.

How reproducible:
Always

Steps to Reproduce:
1. Give a disk a long serial number.  I use an existing VM with one IDE disk for testing, to which I add a second IDE disk with my test serial number, like this:
-drive if=none,id=foo,file=tmp.qcow2,serial=0123456789abcdef -device ide-drive,drive=foo
2. In the guest, run hdparm -i /dev/sdb
  
Actual results:
hdparm shows "SerialNo=01234567"

Expected results:
SerialNo=0123456789abcdef

Additional info:
Fix is a one-liner:

diff --git a/vl.c b/vl.c
index cda2d96..f66c05c 100644
--- a/vl.c
+++ b/vl.c
@@ -2475,7 +2475,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
     dinfo->on_write_error = on_write_error;
     dinfo->opts = opts;
     if (serial)
-        strncpy(dinfo->serial, serial, sizeof(serial));
+        strncpy(dinfo->serial, serial, sizeof(dinfo->serial));
     QTAILQ_INSERT_TAIL(&drives, dinfo, next);
     if (is_extboot) {
         extboot_drive = dinfo;

Comment 2 juzhang 2011-03-16 10:30:31 UTC
can reproduce this bug with qemu-kvm-0.12.1.2-2.150.el6.x86_64 using comment0 step.so mark qa_ack+ flag.

Comment 7 Shaolong Hu 2011-04-02 03:20:05 UTC
Reproduce on qemu-kvm-0.12.1.2-2.150.el6.x86_64:

Steps to Reproduce:
1. Boot guest with:
-drive file=/dev/vg_shutest2/lv_test,cache=none,format=raw,rerror=stop,werror=stop,id=test,if=none,serial=0123456789abcdefg -device ide-drive,drive=test,id=test-device,bootindex=2
2. In the guest, run hdparm -i /dev/sdb

Actual results:
hdparm shows "SerialNo=01234567"



Verify on qemu-kvm-0.12.1.2-2.153.el6.x86_64:

Actual results:
hdparm shows "SerialNo=0123456789abcdefg"



Conclusion:
According to result above, this bug has been fixed.

Comment 8 juzhang 2011-04-02 03:25:13 UTC
According to commnet7,set this issue status as verified.

Comment 9 Eduardo Habkost 2011-05-03 19:09:22 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: bug in the serial number setting code inside qemu-kvm.

Consequence: drive serial number got truncated to 8 characters.

Fix: Fix serial number assignment code.

Result: drive serial number not truncated anymore.

Comment 10 errata-xmlrpc 2011-05-19 11:21:11 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

Comment 11 errata-xmlrpc 2011-05-19 13:02:12 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html


Note You need to log in before you can comment on or make changes to this bug.