Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp80231rdb; Wed, 17 Jan 2024 18:17:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgpTvmN/Ln53QtRbUZze7iQl6Ix8HFpQBsI5j6XbRkjCFU3j1M+IjRP7tj1n9iJxQmijSO X-Received: by 2002:a9d:6383:0:b0:6db:e349:f82e with SMTP id w3-20020a9d6383000000b006dbe349f82emr119409otk.66.1705544250806; Wed, 17 Jan 2024 18:17:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705544250; cv=pass; d=google.com; s=arc-20160816; b=Qkb0JEkZQ2Nk8Pxgx/4m598hM0lW/L4o53DnI1FBRZKzM8JB0+gq53dG98/NkKdI5p Xn+7wBWjNrR9fAbq0hG5rd8nwdTNq2iC4hFDzQ+zGZprmDbLdPuzTVmoEXxsILn+ROlr u0g+LEZ8eQ8ol1UdtXAZ5UKpYqCd/N7aUSr69UVdlzte+4+krTcfxBiywIlzX1sbbehZ nmr8bMW+ft2jNvIhoaHxJ92/RGkLMKtqZ74qC5qdsIHBVWN+/rt3evQXoodK62BRg1EB PfVbg5ntLIgQfc9JkEqgdWNnWc+Cc0uZyPDmLeayUDZxR0s1ekQm2/+BrtQg6ssDn1Ce GOLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=8BGZIpU2ap8uYa2u6o2W22k7x92OI3mbyPBOgiX7Pwo=; fh=dfoPJjS11PB7cHnmSOzER2kK1pPjFG2cyXDf+/ObdmM=; b=QkvTmyCwIIbOfzm6LEJP7qFUz9xY660ZwcZjNy2vQF7deH2yaRVcm/sp8Dw4c+kZN4 hus4BkWYOWHewOclniAfJOe54zpEuigcZkMnsacelJlGOYbd9n2p6+9ANLdg2eeSnXLa Pmb0XnW/OIN1LFQP0BYTnrj1WgRvx4fyW+hlQl497ri6WXuJV27ThFrgaU3ofW/j1kpI 7nKqvglFKbFIHwyleBHDGS3kcVNDResZdoA6xk4iDTAfTplIl7FC9hN94Gf00jGRZFYi x3aK1K6OdwB0dR9k/IhPqgXypYAgE1J+cnG1YLn6cs44iK2/7TxXTvCI3PUyh8ol6jrl kjTQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-29652-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29652-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q4-20020a63f944000000b005ab53fee611si600226pgk.423.2024.01.17.18.17.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 18:17:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29652-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-29652-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29652-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0ECB8B22046 for ; Thu, 18 Jan 2024 02:17:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF1F3567E; Thu, 18 Jan 2024 02:17:10 +0000 (UTC) Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFCC14688; Thu, 18 Jan 2024 02:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705544230; cv=none; b=RJNZbros9eI4DWn+QznziL3ZW+xUPLYwx0ney71VSG8hn2Hon4ZzIvdch6laCDDxtMfWe9YhDGm7PoP/c3R/GLaoXM0eTAAgK1+Wku4uLbJV49U1v+HUO9puVc0r1jGUSG3D4urgMiTtInK+Fc+7XooSSSw6gJPJRoFRNpQ9zyc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705544230; c=relaxed/simple; bh=6momQ9QB/Y9Ip/Db3KbIXMpQk/LKk7SNvyM7o6RGisk=; h=X-UUID:X-CID-P-RULE:X-CID-O-INFO:X-CID-INFO:X-CID-META:X-CID-BVR: X-CID-BAS:X-CID-FACTOR:X-UUID:Received:Received:X-ns-mid:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:Content-Language: To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; b=rgu7TsCqdaabG4yBgPdns6tQAbMOuTsVju0H4YZ68MRVCJM+IXiUWYNOJ0kWD6tv2OTnXN+9Vco+wc4Eu/BzDnOWl6JuQ/FV5wlnKn/tkVfy/qRwaiiVDnE9tSosKNrwC98KnD1H8zfKboz6EYnyxPNWxGkoue5wRzFv6kA8XYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 43d0795174294d89904cf0b7504238dd-20240118 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:1c0bfad0-7b29-415b-9fa2-010a6f2d21e5,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-9,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:1 X-CID-INFO: VERSION:1.1.35,REQID:1c0bfad0-7b29-415b-9fa2-010a6f2d21e5,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-9,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:1 X-CID-META: VersionHash:5d391d7,CLOUDID:7c56f882-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:240118101702QKGYL0XV,BulkQuantity:0,Recheck:0,SF:38|24|17|19|42|74|6 4|66|102,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC: nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 43d0795174294d89904cf0b7504238dd-20240118 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1202952070; Thu, 18 Jan 2024 10:17:02 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id B3C66E000EB9; Thu, 18 Jan 2024 10:17:01 +0800 (CST) X-ns-mid: postfix-65A88A1D-552403442 Received: from [172.20.15.234] (unknown [172.20.15.234]) by mail.kylinos.cn (NSMail) with ESMTPA id 36366E000EB9; Thu, 18 Jan 2024 10:16:58 +0800 (CST) Message-ID: <4d4f4ae4-e5e9-4d9e-ac25-d262e7ea23fc@kylinos.cn> Date: Thu, 18 Jan 2024 10:16:57 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/msm/adreno: Add a null pointer check in zap_shader_load_mdt() Content-Language: en-US To: Markus Elfring , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org, Abhinav Kumar , Dmitry Baryshkov , Daniel Vetter , David Airlie , Marijn Suijten , Rob Clark , Sean Paul Cc: LKML References: <20240116032732.65262-1-chentao@kylinos.cn> <9e390783-05c5-47fc-a0c6-b95e249fe691@web.de> From: Kunwu Chan In-Reply-To: <9e390783-05c5-47fc-a0c6-b95e249fe691@web.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 2024/1/18 02:50, Markus Elfring wrote: >> kasprintf() returns a pointer to dynamically allocated memory >> which can be NULL upon failure. Ensure the allocation was successful >> by checking the pointer validity. > =E2=80=A6 >> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c >> @@ -144,6 +144,10 @@ static int zap_shader_load_mdt(struct msm_gpu *gp= u, const char *fwname, >> char *newname; >> >> newname =3D kasprintf(GFP_KERNEL, "qcom/%s", fwname); >> + if (!newname) { >> + ret =3D -ENOMEM; >> + goto out; >> + } > =E2=80=A6 >=20 > How do you think about to avoid the repetition of the pointer check > for the variable =E2=80=9Cmem_region=E2=80=9D? "mem_region"? Is this a clerical error, do you mean 'newname'? No check found in __qcom_mdt_load for 'newname'. 'newname' is used for printing in '__qcom_mdt_load' in some cases, which=20 is a bit dangerous. So it's necessary check it before using it. > Can the usage of other labels become more appropriate? >=20 > Regards, > Markus --=20 Thanks, Kunwu