Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2332802rda; Tue, 24 Oct 2023 22:20:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHShkOe+BRRoloBkPbMAwLqWkmONzaXAkq3199mI1H0ovVEeuef/PbbojoVW/fpXavgNDzt X-Received: by 2002:a81:6d92:0:b0:5a7:af51:e274 with SMTP id i140-20020a816d92000000b005a7af51e274mr16093126ywc.18.1698211201825; Tue, 24 Oct 2023 22:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698211201; cv=none; d=google.com; s=arc-20160816; b=in0NOJ3c5ER21LUHpnrleUzB8cDXlmRxZ372MQue0J1inuRl9WgBfdf4aIxltclUo5 ZsokOiAl9D3HzQ2wnfL4HOZ1Bvr69DoE+N2eP7GyJvMVzGGXturSC4Ezt6T8nyDnTrZt QjbYiZKUG+lbCj3Wjy8g87ta/02G+RuIoPKZfnlvHkh1jae9+pH2NDssH69IdC9NQo1n FuaSF0JJsAR8jkU3+KiSjsTXv68XNB/CXlf0xlxnJCKojdqBiWCu6Qcy/AS5Mv4IejE+ QvyVGPkYgAzKCb5j4JeakWt9pT0MhPjp2iXkzVze66hUJ2/J/C/mq8AOZE4NZFPmKkr+ fW+Q== 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 :message-id:date:subject:cc:to:from; bh=K8C+wvrgvQEl3jJmVQwUy7bSDOUMHrayrTC7z14nj3k=; fh=UyukDRIvmbC0dCL+tcnwyqTiZPcfu7+YnVy8iK64HDY=; b=CP3mwcIG8wO2YFtDCupAz70MgxdOU9bhRouoPA9WMNzYTbjkZ0SemTdM5JBi8n0jJL bjbUZ+3t2m/GRISMgf6LcECfC/FfgAzl/6aJBxnnBHEIo7bzKPxvdPLnTtm1neEAtE5s d6DKnFRvRueE3ktRXa8uew0V6qco6UTwlCEfPh1YV3pQCE+YPsEw/5bKuPkXKNOmZH1A b+K/L3jIvkpozb69PVUoD0Zpppc/hf9LGXeOZAzHVsegJm4BW/TYAkkL10FrI+CSizct KwLtG9c9JwAZk/Sy3A5EuXFZdsedjkJGjjhpYUUTEPPcqc39aih4BUxTBGCWS07IWSdv 3f5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t198-20020a0deacf000000b005a83f312ad4si9861530ywe.182.2023.10.24.22.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 22:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DF6F5804EE79; Tue, 24 Oct 2023 22:19:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbjJYFTr (ORCPT + 99 others); Wed, 25 Oct 2023 01:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjJYFTq (ORCPT ); Wed, 25 Oct 2023 01:19:46 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 74386A4; Tue, 24 Oct 2023 22:19:43 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id D9480605941A7; Wed, 25 Oct 2023 13:19:35 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: kherbst@redhat.com, lyude@redhat.com, dakr@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: Su Hui , airlied@redhat.com, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] drm/nouveau/nvif: avoid possible memory leak of 'args' Date: Wed, 25 Oct 2023 13:19:23 +0800 Message-Id: <20231025051922.525940-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 24 Oct 2023 22:19:59 -0700 (PDT) Use kfree() to free 'args' before return '-EINVAL'. Signed-off-by: Su Hui --- drivers/gpu/drm/nouveau/nvif/vmm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/nvif/vmm.c b/drivers/gpu/drm/nouveau/nvif/vmm.c index 99296f03371a..a0afe3bf0d78 100644 --- a/drivers/gpu/drm/nouveau/nvif/vmm.c +++ b/drivers/gpu/drm/nouveau/nvif/vmm.c @@ -219,6 +219,7 @@ nvif_vmm_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass, case RAW: args->type = NVIF_VMM_V0_TYPE_RAW; break; default: WARN_ON(1); + kfree(args); return -EINVAL; } -- 2.30.2