From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 1/1] drm: avoid exposing kernel stack in compat_drm_getstats Date: Mon, 22 Aug 2016 09:27:18 +0200 Message-ID: <20160822072718.GC6232@phenom.ffwll.local> References: <1471802179-2886-1-git-send-email-xypron.glpk@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1471802179-2886-1-git-send-email-xypron.glpk@gmx.de> Sender: linux-kernel-owner@vger.kernel.org To: Heinrich Schuchardt Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Sun, Aug 21, 2016 at 07:56:19PM +0200, Heinrich Schuchardt wrote: > The C standard does not specify the size of the integer used > to store an enum. Hence in structure drm_stats32_t alignment > bytes may exist. > > To avoid exposing bytes from the kernel stack it is > necessary to initialize variable s32 completely. > > Signed-off-by: Heinrich Schuchardt Applied to drm-misc, thanks. -Daniel > --- > drivers/gpu/drm/drm_ioc32.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c > index 57676f8..32a489b 100644 > --- a/drivers/gpu/drm/drm_ioc32.c > +++ b/drivers/gpu/drm/drm_ioc32.c > @@ -346,6 +346,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd, > struct drm_stats __user *stats; > int i, err; > > + memset(&s32, 0, sizeof(drm_stats32_t)); > stats = compat_alloc_user_space(sizeof(*stats)); > if (!stats) > return -EFAULT; > -- > 2.1.4 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch