Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3034407rwb; Mon, 15 Aug 2022 16:34:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR6wUy9I/YsWcayc4Tm6wIkGG0EJsYuLxSwMEBmhS6Pci8dO4HXlTycoWvftVh6yB2XcLhex X-Received: by 2002:a17:907:6818:b0:730:825d:7296 with SMTP id qz24-20020a170907681800b00730825d7296mr12261833ejc.21.1660606447340; Mon, 15 Aug 2022 16:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660606447; cv=none; d=google.com; s=arc-20160816; b=gxVN8ErY6St9EyT9chYw3r/hYSaNI0XlFCgiGPTCWL97PGVvV3jxqae9tiXRx5xr+s Fm3Evk69StpAsm4xqUU+U699hd8cj9859o6K7xP8Lrp6/M6JXO/1UQiI1/c1LwTlUgk6 Jrk54Yqf0PRQW2idfm2KO0q9QUsDAKTv+gG22k7JTlAwD3PLHqz5yuDFYZJ0kyjL3/bu QiqhqsV/qysQe+gpkzjPv63u5v3TF0+sE7f0iNoyiX95hoG1cLIBAauvGs330q+fppe0 5s0hsDyyVUlX1F1ggB/obHagL01a2gFbGIZ6fZH6OmV+i2ADIppGjQOY81uYRC22ts9a yRvA== 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=b/Z5n9sgZ5JXGB31Un7Ba78FODLb8p656Jm92+c/k07s5oy1l+XPA4eJhHOqDSC6de q5SFNMo1nkjBYedQPuc/KTJSB0oSyYDG7+33QV5YPvOngDHtlR17DUaeHp+trddfq5QA 0D0RvxYWR2YH0+PFlsEJrzpy14j2dLeLK2+71RIyOVm/VEy0G0b+Jyq/ldM+SYlvMnj8 8w7EKWz0T051vJs/ddzgFbraFA5nJD94xqIxksZap2/Wf/uxZotIyw7QlypdZPCOBqvb cvQjp3UMA6trK3jA7lZtKojlnQXUSEDbR6o37F/6liM4N5kG7DlzoPWj3j68W0IWjhaS PERQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LVkWcV6p; 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 x7-20020a056402414700b0043d10cc3a66si8046130eda.403.2022.08.15.16.33.18; Mon, 15 Aug 2022 16:34:07 -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=LVkWcV6p; 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 S245399AbiHOX3P (ORCPT + 99 others); Mon, 15 Aug 2022 19:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239853AbiHOXWj (ORCPT ); Mon, 15 Aug 2022 19:22:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC50148E83; Mon, 15 Aug 2022 13:05:28 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6B0CEB810C5; Mon, 15 Aug 2022 20:05:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1CF9C433C1; Mon, 15 Aug 2022 20:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593926; bh=8wmv2mpi8sUIIu/K8J/rRbiyFnvYWdh1DOEZEe1g1cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVkWcV6pdTSl+Mxe0eL1ihUuJ4ZCVXN9uXuvXhIgsaIk9Slb4MYnY3Q4Fcd7DOwEU gdj4ERtTOdoocw6fkASQC6RH3S5uesIHdlZF52HITA1zSaS+SnfiHHlDYcasc4M7JR A3DrPirDVMiTWZb6LKuRoWkAxxq6Aj43qIAthTNI= 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.19 0349/1157] drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init Date: Mon, 15 Aug 2022 19:55:05 +0200 Message-Id: <20220815180453.676436520@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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