From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: Re: [Spice-devel] [PATCH 1/3] drm/qxl: add mode/framebuffer check functions Date: Wed, 16 Jan 2019 12:28:00 +0100 Message-ID: <20190116112800.v73xmxedt4b3gktj__29342.764177318$1547692501$gmane$org@sirius.home.kraxel.org> References: <20190116083521.22673-1-kraxel@redhat.com> <20190116083521.22673-2-kraxel@redhat.com> <636470684.58090538.1547630691403.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <636470684.58090538.1547630691403.JavaMail.zimbra@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Frediano Ziglio Cc: David Airlie , open list , dri-devel@lists.freedesktop.org, "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Daniel Vetter , Dave Airlie , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" List-Id: virtualization@lists.linuxfoundation.org > > +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 ... > > - 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