[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr)


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Tim Deegan <tim@xxxxxxx>
  • Date: Thu, 5 Apr 2012 16:51:53 +0100
  • Delivery-date: Thu, 05 Apr 2012 16:09:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1333640955 -3600
# Node ID a93381049790e4f8a02f2322851f78175c254c5b
# Parent  4674ce03c62a3e916954fd445b4510ffe72e64f4
x86: fix memset(ptr, 0, sizeof ptr).

Signed-off-by: Tim Deegan <tim@xxxxxxx>

diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/cpu/mcheck/amd_f10.c
--- a/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
@@ -73,9 +73,9 @@ amd_f10_handler(struct mc_info *mi, uint
                return NULL;
        }
 
-       memset(mc_ext, 0, sizeof(mc_ext));
+       memset(mc_ext, 0, sizeof(*mc_ext));
        mc_ext->common.type = MC_TYPE_EXTENDED;
-       mc_ext->common.size = sizeof(mc_ext);
+       mc_ext->common.size = sizeof(*mc_ext);
        mc_ext->mc_msrs = 3;
 
        mc_ext->mc_msr[0].reg = MSR_F10_MC4_MISC1;
diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c     Thu Apr 05 16:49:15 2012 +0100
@@ -1232,11 +1232,10 @@ bool_t p2m_mem_access_check(unsigned lon
     }
 
     *req_ptr = NULL;
-    req = xmalloc(mem_event_request_t);
+    req = xzalloc(mem_event_request_t);
     if ( req )
     {
         *req_ptr = req;
-        memset(req, 0, sizeof(req));
         req->reason = MEM_EVENT_REASON_VIOLATION;
 
         /* Pause the current VCPU */

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.