From: Ian Jackson Subject: Hazardous memset/memcpy idiom (was Re: [PATCH] x86: fix null pointer dereference in intel_get_extended_msrs()) Date: Wed, 27 Feb 2013 11:47:42 +0000 Message-ID: <20781.62046.887326.863656@mariner.uk.xensource.com> References: <1361598228-25041-1-git-send-email-xi@mit.edu> <20780.60434.402629.740920@mariner.uk.xensource.com> <512DD6EB02000078000C159C@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <512DD6EB02000078000C159C@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Xi Wang , "xen-devel@lists.xen.org" , Keir Fraser , "Tim (Xen.org)" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Jan Beulich writes ("Hazardous memset/memcpy idiom (was Re: [Xen-devel] [PATCH] x86: fix null pointer dereference in intel_get_extended_msrs())"): > Unfortunately that wouldn't be usable in all cases (arrays passed > to functions), #define FILLZERO_ARRAY(arrayobj, num_elements) \ (memset((arrayobj),0,sizeof((arrayobj)[0])*(num_elements))) And the fact that a macro isn't universally applicable isn't a reason not to replace an error-prone idiom in the very frequent cases where the macro would be applicable. Ian.