From patchwork Wed Sep 30 21:08:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 7303491 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 69CD19F506 for ; Thu, 1 Oct 2015 00:53:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88A19206FB for ; Thu, 1 Oct 2015 00:53:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1658420726 for ; Thu, 1 Oct 2015 00:53:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0AD56E8F5; Wed, 30 Sep 2015 17:53:33 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTPS id 780AB721A0 for ; Wed, 30 Sep 2015 14:08:23 -0700 (PDT) Received: by wiclk2 with SMTP id lk2so1388266wic.1 for ; Wed, 30 Sep 2015 14:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=pS1V2NbXOOiL0tuIQo5VmKTcc2jouN68nepOCSZS6R4=; b=iIDjMD8fsZQDadumqqWeG8fIPXvHJxxzfMuvedL9L60S/5lJu51bNwwbTuzNVJNLD+ VHgZA5mzWHLgJwfI0N6nfE5xptAqJvpRVAKYM+2zNYo35QCcVhmCXL8EWMi1wHSTYdWz 6gmKhCDvuk6zaqfR/r+B+tudzwCEQrNQfcXe0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=pS1V2NbXOOiL0tuIQo5VmKTcc2jouN68nepOCSZS6R4=; b=hpb49YP5+Hs6RB1ICXo9FcBgyNdvIPy5eCvTle8jfp3hh+ZLj1N3ivYEi77k5cmeYp GjYsUt4Re1KrrEGLbaB28ldz1ge6dccBck7U+pRL4+kSVpTxz5PXNzkVd27QIGNBuppw Kg4m2h2D3SFHjEQ9iGB/QC7AWibiBpFXabwfBo6j2Hr4Wx9g0OvILk4GTjxwq5yUTaA8 7QGjuTCDyKWTDtfBm/oEF7q5k9123m212/doHKyLtmz5Z8Lni2rG+PmbrOjMA7s3MX/R qy7EkrIXNFMm1gvZT36GJMDhdKB8RxJkH5a6epPn1q6EZZFcor9yF4CFVFNxON9b2LI+ E0UA== X-Gm-Message-State: ALoCoQkrTIf1Stb6y8Twwz9UHGM+S18TbO12E3kj8ZjcM6/NZSldAdvVPrqtg2OSwlFJksDD9g6x X-Received: by 10.180.105.135 with SMTP id gm7mr32528085wib.18.1443647301527; Wed, 30 Sep 2015 14:08:21 -0700 (PDT) Received: from morgan.rasmusvillemoes.dk (ip-45-63.bnaa.dk. [84.238.45.63]) by smtp.gmail.com with ESMTPSA id kb9sm2527792wjb.49.2015.09.30.14.08.20 (version=TLS1_2 cipher=AES128-SHA256 bits=128/128); Wed, 30 Sep 2015 14:08:21 -0700 (PDT) From: Rasmus Villemoes To: kbuild test robot Subject: Re: [PATCH 1/2] drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl() Organization: D03 References: <201510010454.nwCLjpXA%fengguang.wu@intel.com> X-Hashcash: 1:20:150930:kbuild-all@01.org::YcVLcBBGvTqEYxEC:000000000000000000000000000000000000000000000nrb X-Hashcash: 1:20:150930:lkp@intel.com::H9+UCWRkyeNl5/WJ:000023VF X-Hashcash: 1:20:150930:airlied@linux.ie::8LnSy/cNgyxi1d/Y:01i48 X-Hashcash: 1:20:150930:dri-devel@lists.freedesktop.org::PS5Su2cLwf0+6eQL:000000000000000000000000000000Cyzw X-Hashcash: 1:20:150930:linux-kernel@vger.kernel.org::meHXR5rBSnF1T6/q:000000000000000000000000000000000Fx5+ Date: Wed, 30 Sep 2015 23:08:20 +0200 In-Reply-To: <201510010454.nwCLjpXA%fengguang.wu@intel.com> (kbuild test robot's message of "Thu, 1 Oct 2015 04:54:47 +0800") Message-ID: <87vbarehtn.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 30 Sep 2015 17:53:24 -0700 Cc: kbuild-all@01.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Sep 30 2015, kbuild test robot wrote: > Hi Rasmus, > > [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore] > > > coccinelle warnings: (new ones prefixed by >>) > >>> drivers/gpu/drm/vmwgfx/vmwgfx_surface.c:771:1-13: alloc with no test, possible model on line 817 > > vim +771 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > > 543831cf Thomas Hellstrom 2012-11-20 765 > 543831cf Thomas Hellstrom 2012-11-20 766 srf->sizes = kmalloc(srf->num_sizes * sizeof(*srf->sizes), GFP_KERNEL); > 543831cf Thomas Hellstrom 2012-11-20 767 if (unlikely(srf->sizes == NULL)) { > 543831cf Thomas Hellstrom 2012-11-20 768 ret = -ENOMEM; > 543831cf Thomas Hellstrom 2012-11-20 769 goto out_no_sizes; > 543831cf Thomas Hellstrom 2012-11-20 770 } > 543831cf Thomas Hellstrom 2012-11-20 @771 srf->offsets = kmalloc(srf->num_sizes * sizeof(*srf->offsets), > 543831cf Thomas Hellstrom 2012-11-20 772 GFP_KERNEL); > 543831cf Thomas Hellstrom 2012-11-20 773 if (unlikely(srf->sizes == NULL)) { > 543831cf Thomas Hellstrom 2012-11-20 774 ret = -ENOMEM; > 543831cf Thomas Hellstrom 2012-11-20 775 goto out_no_offsets; > 543831cf Thomas Hellstrom 2012-11-20 776 } > 543831cf Thomas Hellstrom 2012-11-20 777 Wauv, that was fast. So, I'm pretty sure this has nothing to do with the patch I just sent, but there's a bug nevertheless. The NULL test has been copy-pasted from just above, but we're testing srf->sizes again, not srf->offsets which we just tried to allocate. Subject: [PATCH] drm/vmwgfx: check kmalloc return value srf->sizes has been allocated and checked a few lines above; fix up the copy-pasto so that we check srf->offsets. Reported-by: kbuild test robot Signed-off-by: Rasmus Villemoes --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 64b50409fa07..0cf0055e0e08 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -770,7 +770,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, } srf->offsets = kmalloc(srf->num_sizes * sizeof(*srf->offsets), GFP_KERNEL); - if (unlikely(srf->sizes == NULL)) { + if (unlikely(srf->offsets == NULL)) { ret = -ENOMEM; goto out_no_offsets; }