Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp264795rdb; Mon, 22 Jan 2024 03:37:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHy4gpFOVNEZRHA4vzf7eNupLvIP66HjrXKX8H30AGDv0Zv7vBEDmH4+gPSoqrFoFxcx/gb X-Received: by 2002:a05:620a:c9a:b0:783:63c5:281e with SMTP id q26-20020a05620a0c9a00b0078363c5281emr4842053qki.145.1705923421390; Mon, 22 Jan 2024 03:37:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705923421; cv=pass; d=google.com; s=arc-20160816; b=ExcTY7MPxs13YlXKkEjeNfTV71P8EDwfBvdDdJhL5gzqwE1A4w6rwPYqhRyTsK7DSP rSZJfxp0dbBbkB8Rz7OYH/uDXkTwMoThMxUn2n1THu81KzXXASxdr+pfDa91wie+rWfo NO4ax+YBTENBOAkLRc6meQQRuC/spSe0to9rheNmyoGK4DcNMR4G3FQfOKaw4wqtGCZQ Ma3hWsxFYD036lB9A8pu16k56ZSsw2HxGjTWgIeOUqsY/bsOkVRyd+JaOn6PyBqJJex4 6Vep6/NsHVSls9cy2+yPvDEpfZHJCrpnjt/ctWGc46Ev45dJW28q9JlcGb5AKwBLMwZO OhWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7gBUZlPcZnKEddHRjnl9qOdrNvm9sno9nmxNtwOoglc=; fh=7FbOvTKS7Tz51BwTYlN15cRqddMP6omNHLrPQCcI3Kg=; b=g29UbGxbcGuygxV0Fs8dYm5BHHHewU7bafR4xknzvszzB22KqY5JRkjuO+1nMGtpBI oc1f3P7U1TSfiEYcT2B94fpGYgMAMAMuWByMk/ZAlnygjnA1FHiwBtgWVSVH42dVeUfs zh2NMfMXI4vO69G+xy0cENzWSaw2OSe2duFBHXEHP3OOvm1DJkdeVvfEZ6fuy+HGWP/O +NRxbWeBdmMKM1I3RsMwX5OGUa5uL5+F1WYNfUzhQvV1qVjEfmMmzSmF5ad+i6sywH/Q IH44QUgZXDzWAc6ytI8xu91lhD3F8OdO3vu47h9375Sp4YykAmhEXNHz886tAtTA7HfH PpmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=imsnVuc7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v15-20020a05620a0a8f00b0078337e502f8si5321022qkg.688.2024.01.22.03.37.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:37:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=imsnVuc7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C219D1C267F2 for ; Mon, 22 Jan 2024 11:35:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DDDE73DBBE; Mon, 22 Jan 2024 11:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="imsnVuc7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 105403DBB0; Mon, 22 Jan 2024 11:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705922725; cv=none; b=bfbU634Scj1vUAwL//7LHssM4Q0HMU3jtXbh0QS6eTBevBjkOdbdRcFIpsIqXcukEr7NEBzvuTA5crpwnEzx4pzLbqJPc/q7q2Yo/pnX5FPTnnay6D61Durg7r2k0gGDMMX7vgfkxf6rNgWnIcpZsuucrqokeDyCvSD/NojbL5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705922725; c=relaxed/simple; bh=naLbjV/nZJ/rNLJukcUgemet47PrR8ph+3UFQiJOLpU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lRSiQFAPp1AWEpU+PvpnEEc8egriBKBesB+2l357zySeOTP2mB+sop4loHcY6K9HAw1AD/gwSwELZFwYq5gUjCYTxhVEQvK6/CuZ0D4HP934DEDu5ucpazMdFB7DXiu0RzF/4DgJGJ4zPRwVo7zljSZAsNbb/bWz0UtdAar+P/k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=imsnVuc7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D234C43390; Mon, 22 Jan 2024 11:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705922724; bh=naLbjV/nZJ/rNLJukcUgemet47PrR8ph+3UFQiJOLpU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=imsnVuc7ttDbq2JJ30rmecyU4XFNk/M4GbiiDUTA6a310sPAGfk/KfYiTZMm6pkU1 XlEraDm5UVpHRBqHQUPfUNg09lpRayvZwqLuGa1fRQSTfzZJsLMyvqtK3aQJP08Ffy I26PeemCCRhdmqZjtlhbYD6g9+1SxQcFI9GxxSusVhtTAQ2sdsNpU50/gBF4YxppZD 9RE5PnKIq+Sv2BLJZQ6GXftLSqWyy85oXMXmnEGaw9SvSUysSqpgZCGwbyd87++VTw 7lUkpiO5UbX5iCGttGAxGMv5TsGxe03gaSmPwKm/X8GNVDO47waGQD3DkSRXejKAin m6odbpsAPIJKg== Date: Mon, 22 Jan 2024 16:55:20 +0530 From: Vinod Koul To: Kunwu Chan Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: Add a null pointer check to the dma_request_chan Message-ID: References: <20240118033052.193282-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240118033052.193282-1-chentao@kylinos.cn> On 18-01-24, 11:30, Kunwu Chan 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. > > Signed-off-by: Kunwu Chan > --- > drivers/dma/dmaengine.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index 491b22240221..a6f808d13aa4 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -856,6 +856,8 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name) > #ifdef CONFIG_DEBUG_FS > chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), > name); > + if (!chan->dbg_client_name) > + return chan; That is wrong, you cant return a half done channel here Pls see rest of the code for reference > #endif > > chan->name = kasprintf(GFP_KERNEL, "dma:%s", name); > -- > 2.39.2 -- ~Vinod