aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrew Cooper <andrew.cooper3@citrix.com>2013-09-27 10:15:28 +0200
committerJan Beulich <jbeulich@suse.com>2013-09-27 10:15:28 +0200
commit62466514cc419152fa2f33dc9aa986d0a2fc519a (patch)
treeb34f0b35677ce7db95a4c58edaec1b08db310faa /tools
parent0af438757d455f8eb6b5a6ae9a990ae245f230fd (diff)
downloadxen-62466514cc419152fa2f33dc9aa986d0a2fc519a.tar.gz
xen-62466514cc419152fa2f33dc9aa986d0a2fc519a.tar.bz2
xen-62466514cc419152fa2f33dc9aa986d0a2fc519a.zip
hvmloader/smbios: Change strncpy to memcpy for anchor strings
Coverity complains about the use of strncpy() to completely fill the anchor strings, resulting in an unterminated string. Although the strncpy result is correct, the anchor strings are not strings in the C sense, and use of memcpy is the prevaling style elsewhere in hvmloader anyway. While tidying up the style in this function, also remove some trailing whitespace and gratuitous cast. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware/hvmloader/smbios.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c
index 9f292ccd37..4d3d69273d 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -347,18 +347,18 @@ smbios_entry_point_init(void *start,
{
uint8_t sum;
int i;
- struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
+ struct smbios_entry_point *ep = start;
memset(ep, 0, sizeof(*ep));
- strncpy(ep->anchor_string, "_SM_", 4);
+ memcpy(ep->anchor_string, "_SM_", 4);
ep->length = 0x1f;
ep->smbios_major_version = 2;
ep->smbios_minor_version = 4;
ep->max_structure_size = max_structure_size;
ep->entry_point_revision = 0;
- strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
-
+ memcpy(ep->intermediate_anchor_string, "_DMI_", 5);
+
ep->structure_table_length = structure_table_length;
ep->structure_table_address = structure_table_address;
ep->number_of_structures = number_of_structures;