From: Cathy Avery Date: Mon, 24 Sep 2012 18:28:39 +0000 (-0400) Subject: [ovmapi] changed instances of strncmp to strcmp X-Git-Tag: v2.6.39-400.9.0~303^2~64 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1bba66c5d39136b0300d6c87d651507fbfa6254d;p=users%2Fjedix%2Flinux-maple.git [ovmapi] changed instances of strncmp to strcmp Orabug: 14644624 Changed instances of strncmp to strcmp. If the current size is shorter and the param names are partly duplicated then the compare succeeds and writes the new value into the wrong parameter. Signed-off-by: Cathy Avery --- diff --git a/drivers/xen/ovmapi.c b/drivers/xen/ovmapi.c index 25758d943c88..a44a98371d6f 100644 --- a/drivers/xen/ovmapi.c +++ b/drivers/xen/ovmapi.c @@ -631,8 +631,7 @@ static int ovmapi_add_parameter(struct ovmapi_information *p_ovmapi_info, /* check for duplication */ list_for_each_entry(parameter, &p_ovmapi_info->parameter_list, list) { - if (strncmp(name, parameter->name, - parameter->name_size) == 0) { + if (strcmp(name, parameter->name) == 0) { kfree(parameter->value); parameter->value = value; parameter->value_size = value_size; @@ -684,8 +683,7 @@ static int ovmapi_delete_parameter(struct ovmapi_information *p_ovmapi_info, mutex_lock(&p_ovmapi_info->parameter_mutex); list_for_each_entry_safe(parameter, next, &p_ovmapi_info->parameter_list, list) { - if (strncmp(message.name, parameter->name, - parameter->name_size) == 0) { + if (strcmp(message.name, parameter->name) == 0) { list_del(¶meter->list); kmem_cache_free(name_cache, parameter->name); kfree(parameter->value); @@ -712,8 +710,7 @@ static int ovmapi_read_parameter(struct ovmapi_information *p_ovmapi_info, mutex_lock(&p_ovmapi_info->parameter_mutex); list_for_each_entry(parameter, &p_ovmapi_info->parameter_list, list) { - if (strncmp(message.name, parameter->name, - parameter->name_size) == 0) { + if (strcmp(message.name, parameter->name) == 0) { if (parameter->value_size > message.value_size) { message.value_size = parameter->value_size; mutex_unlock(&p_ovmapi_info->parameter_mutex); @@ -755,8 +752,7 @@ static int ovmapi_get_parameter_value_size( mutex_lock(&p_ovmapi_info->parameter_mutex); list_for_each_entry(parameter, &p_ovmapi_info->parameter_list, list) { - if (strncmp(message.name, parameter->name, - parameter->name_size) == 0) { + if (strcmp(message.name, parameter->name) == 0) { message.value_size = parameter->value_size; mutex_unlock(&p_ovmapi_info->parameter_mutex); if (copy_to_user(user_buffer, &message,