Skip to content

Commit

Permalink
x86, pat: Proper init of memtype subtree_max_end
Browse files Browse the repository at this point in the history
subtree_max_end that was recently added to struct memtype was not getting
properly initialized resulting in

WARNING: kmemcheck: Caught 64-bit read from uninitialized memory
in memtype_rb_augment_cb()
reported here
https://bugzilla.kernel.org/show_bug.cgi?id=16092

This change fixes the problem.

Reported-by: Christian Casteyde <casteyde.christian@free.fr>
Tested-by: Christian Casteyde <casteyde.christian@free.fr>
Signed-off-by: Venkatesh Pallipadi <venki@google.com>
LKML-Reference: <1276217101-11515-1-git-send-email-venki@google.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
  • Loading branch information
Venkatesh Pallipadi authored and H. Peter Anvin committed Jun 11, 2010
1 parent 055c472 commit 6a4f3b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/mm/pat.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
return -EINVAL;
}

new = kmalloc(sizeof(struct memtype), GFP_KERNEL);
new = kzalloc(sizeof(struct memtype), GFP_KERNEL);
if (!new)
return -ENOMEM;

Expand Down
1 change: 1 addition & 0 deletions arch/x86/mm/pat_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type)
if (ret_type)
new->type = *ret_type;

new->subtree_max_end = new->end;
memtype_rb_insert(&memtype_rbroot, new);
}
return err;
Expand Down

0 comments on commit 6a4f3b5

Please sign in to comment.