From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [Spice-devel] [PATCH 1/3] drm/qxl: add mode/framebuffer check functions Date: Wed, 16 Jan 2019 14:21:41 +0100 Message-ID: <20190116132141.GX10517@phenom.ffwll.local> References: <20190116083521.22673-1-kraxel@redhat.com> <20190116083521.22673-2-kraxel@redhat.com> <636470684.58090538.1547630691403.JavaMail.zimbra@redhat.com> <20190116112800.v73xmxedt4b3gktj@sirius.home.kraxel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190116112800.v73xmxedt4b3gktj@sirius.home.kraxel.org> Sender: linux-kernel-owner@vger.kernel.org To: Gerd Hoffmann Cc: Frediano Ziglio , dri-devel@lists.freedesktop.org, David Airlie , open list , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Daniel Vetter , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Dave Airlie List-Id: dri-devel@lists.freedesktop.org On Wed, Jan 16, 2019 at 12:28:00PM +0100, Gerd Hoffmann wrote: > > > +static int qxl_check_mode(struct qxl_device *qdev, > > > + unsigned int width, > > > + unsigned int height) > > > +{ > > > + if (width * height * 4 > qdev->vram_size) > > > > Is someone checking for integer overflows already? > > Need to have a look. This is just ... The addfb ioctl checks for integer overflows for you. -Daniel > > > > - if (bo->surf.stride * bo->surf.height > qdev->vram_size) { > > > - DRM_ERROR("Mode doesn't fit in vram size (vgamem)"); > > > - return -EINVAL; > > > - } > > ... that check moved into the new function. > > cheers, > Gerd > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch