]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
[ovmapi] changed instances of strncmp to strcmp
authorCathy Avery <cathy.avery@oracle.com>
Mon, 24 Sep 2012 18:28:39 +0000 (14:28 -0400)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Fri, 28 Sep 2012 09:38:24 +0000 (02:38 -0700)
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 <cathy.avery@oracle.com>
drivers/xen/ovmapi.c

index 25758d943c886156739c401660ecaae7e71c3238..a44a98371d6fc57865562236f0a0e7ef71a94a23 100644 (file)
@@ -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(&parameter->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,