Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2928577rwb; Mon, 15 Aug 2022 14:14:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ZAftx3XjI47/zK8t2B+aLlg5e4t0wnH8BXnktxiyNWqlipWKF23HWW4T4v2ROUrXe0j1k X-Received: by 2002:a17:90a:db0d:b0:1f3:a48e:46b3 with SMTP id g13-20020a17090adb0d00b001f3a48e46b3mr30593084pjv.72.1660598051129; Mon, 15 Aug 2022 14:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598051; cv=none; d=google.com; s=arc-20160816; b=hA6ysHAR0jh22xhSmqpiIVW8+Rlq7K8s/fKd8z8iYtfqhjEv1KL3/6jCpmjqRbNgVx 0JLK1qFaQoZmcQ4RNys874kCaGEcBpFI+4V2LOVo5ygIQYBYGVq/pQhUj4yEPPmn0L1H 2QyTku6uxnAVliEa2eMeU1cgNmtvVYODAZapkH06Ek64uM1dJj1F2oyxXk7NB2VEjf5T kiwaG2A93yDdK0RR9h+4GwJ1n4O8hPJUNTtIrMPinhEUDTgwk0yrouj8tREDD5BCuzGz YuZ+sksW4ent0fYPm9sNMXhtUdKyi2rRUz80QW4/CecyBt7fryhErAJXtP8IL99eUpS+ OiFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v3+LuQtG1bFK6fx/8UHz3aMpc/Ce4GVUX2fs9tf3Zgo=; b=u4c4hjJh7MuJLgPWUCYImxwyk6Y531RxAc7jmfza3Xrn3VbZs8Ni2njLTKLpN67n7x vdk+oVAasijNS7+x63AI2o3N5vsMC/l/pKuI5Amt3kkt6jHaTrMjMkfgd0LB3pFxRD5i EwbZa1hOW/DXewXang6Y3rA3FveBm4ptX5qW9qxmlobW+P2x37L8qR7RTfbvBTNJaGiw tpNdt3Ex3be7MIBGoo86jKPj+iCAeR14ZwHb25cwbzyMNSdnlkEDIpZ9ckH/Kv2RjPtt 9a0e7WojzQ0K9+kdoXAU/+bfYlfdczAyDczg7Il17oJ3Tf5C+VvkRfedUMKabNyMHyNI 4ToA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y81LozF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls7-20020a17090b350700b001f563c6733esi19057057pjb.63.2022.08.15.14.13.58; Mon, 15 Aug 2022 14:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y81LozF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbiHOU7S (ORCPT + 99 others); Mon, 15 Aug 2022 16:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245616AbiHOU5d (ORCPT ); Mon, 15 Aug 2022 16:57:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F78CC0E70; Mon, 15 Aug 2022 12:12:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61E8960ED3; Mon, 15 Aug 2022 19:12:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 582FAC433D6; Mon, 15 Aug 2022 19:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590748; bh=8wmv2mpi8sUIIu/K8J/rRbiyFnvYWdh1DOEZEe1g1cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y81LozF5T9LYLXNL91gSztuxk/cASvtFHEpXXY/1vBcMqjsJPpIuzi5gKsiRn9xOg g4YpGR5J3I46apOv6o1w0gsoU1aDB7k0Mm5rtCjn/p1hwBdI/u3ssspD/3OwYaNHbh NS8KWJBLvFMI71pZCSQ9G+Jh4f+QMnpHeh6jea9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.18 0331/1095] drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init Date: Mon, 15 Aug 2022 19:55:30 +0200 Message-Id: <20220815180443.479575554@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit c24968734abfed81c8f93dc5f44a7b7a9aecadfa ] Since drm_prime_pages_to_sg() function return error pointers. The drm_gem_shmem_get_sg_table() function returns error pointers too. Using IS_ERR() to check the return value to fix this. Fixes: 2f2aa13724d5 ("drm/virtio: move virtio_gpu_mem_entry initialization to new function") Signed-off-by: Miaoqian Lin Link: http://patchwork.freedesktop.org/patch/msgid/20220602104223.54527-1-linmq006@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index f293e6ad52da..1cc8f3fc8e4b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -168,9 +168,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, * since virtio_gpu doesn't support dma-buf import from other devices. */ shmem->pages = drm_gem_shmem_get_sg_table(&bo->base); - if (!shmem->pages) { + if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); - return -EINVAL; + return PTR_ERR(shmem->pages); } if (use_dma_api) { -- 2.35.1