security: trusted foundations: fix coarse_page_table_array init
Chris Johnson [Thu, 26 Jan 2012 06:57:37 +0000 (22:57 -0800)]
On the first allocation of a coarse page array, explicitly set the
ref_count to 1, rather than incrementing (as the allocator used may
not guarantee a zero initted struct).

Bug 928289

Signed-off-by: Chris Johnson <cwj@nvidia.com>
Reviewed-on: http://git-master/r/77514
(cherry picked from commit 7329d105883f8b5db87a45085cf6c47c234c4126)

Change-Id: Ic33eecfaf0620340dd430dfa43793fbf0bd8ad8f
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-on: http://git-master/r/79998
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

security/tf_driver/tf_comm.c

index 8b12f29..16915be 100644 (file)
@@ -236,7 +236,7 @@ struct tf_coarse_page_table *tf_alloc_coarse_page_table(
                                 */
                                coarse_pg_table =
                                        &(array->coarse_page_tables[i]);
-                               array->ref_count++;
+                               array->ref_count = 1;
                        } else {
                                /*
                                 * The other elements are added to the free list