From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932735AbbHZFpx (ORCPT ); Wed, 26 Aug 2015 01:45:53 -0400 Received: from smtprelay0138.hostedemail.com ([216.40.44.138]:52623 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932622AbbHZFpu (ORCPT ); Wed, 26 Aug 2015 01:45:50 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3866:3867:3868:3870:3871:3873:4321:5007:6119:6261:7903:10004:10400:10848:11026:11232:11658:11914:12517:12519:12740:13069:13255:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: pot52_8a08450adc803 X-Filterd-Recvd-Size: 1707 Message-ID: <1440567947.2670.179.camel@perches.com> Subject: Re: [PATCH V2 1/3] kvm: use kmalloc() instead of kzalloc() during iodev register/unregister From: Joe Perches To: Jason Wang Cc: gleb@kernel.org, pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, cornelia.huck@de.ibm.com, "Michael S. Tsirkin" Date: Tue, 25 Aug 2015 22:45:47 -0700 In-Reply-To: <55DD50FA.1050608@redhat.com> References: <1440488835-4388-1-git-send-email-jasowang@redhat.com> <1440516546.2670.88.camel@perches.com> <55DD50FA.1050608@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2015-08-26 at 13:39 +0800, Jason Wang wrote: > > On 08/25/2015 11:29 PM, Joe Perches wrote: > > On Tue, 2015-08-25 at 15:47 +0800, Jason Wang wrote: > >> > All fields of kvm_io_range were initialized or copied explicitly > >> > afterwards. So switch to use kmalloc(). > > Is there any compiler added alignment padding > > in either structure? If so, those padding > > areas would now be uninitialized and may leak > > kernel data if copied to user-space. > > > I get your concern, but I don't a way to copy them to userspace, did you? I didn't look. I just wanted you to be aware there's a difference and a reason why kzalloc might be used even though all structure members are initialized.