Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1266215ybl; Wed, 8 Jan 2020 14:06:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxmCNdqJ+GUE6x8/fkdN0aoA6pSemxpytNLONbvtUMp/S/beH5LIZ0oO2t0DyRM7Xrw9PVB X-Received: by 2002:a05:6830:ce:: with SMTP id x14mr6062342oto.105.1578521186025; Wed, 08 Jan 2020 14:06:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578521186; cv=none; d=google.com; s=arc-20160816; b=hi9lNQLUu3yNuN/J4sh5/Upq0nOdNjHr1uQ6Wi8Z56HnDQelgpnTCrGDon6kw41bww DSJgshUDLpGGLpYDFA/YcIgaQc3X0WbsUeyjwgcX1PxRVYhmrR2fynm26UzVfH/j9bik 7k3qlJDV80gOZf9BmZRYNTOkqsTirvm8wGRAZsS92SKOT6BDI/lGj/oGNsBLF2HR67wL dTzSUXByEfG2rieqtdCmwsvanvhS8M4vxjz9bXxC+OukKcziO5C5N0+SWe5+wO0X6fIU MnxP6ntMOa/A0n/b0rzwsArb2KkEwbB6hd78sWF8wcfz7A46DXdxbXIjnzLcco6eGNxD ynhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=IcyswCFyymNMB04vO+luaCp5FYrOURc+YykV7SiTOg0=; b=nf3zoGN/HHCS7QPlO5iP7AL8wE26uCdESc+bCk470sB9mPQ+GS4AP7aSKbsumZvctw KNd2HP5jeFRKX+mZyycqF1r6VigFhMzS/9KeIKmwgzPoEjDtRS1PSVZeEM/CchEYalfB 0D+QiQCod3pxu8PEB+tF/K1H/73coNTasTlLjR+icXgS/McgHmG204EBrF3LQTwAX3Bs M6xgp3cnr25z/Ge7ZCCFLknkDZbGmzY/YS5js4hYZ+r8ZUns9ddCPpx59II6UDnDofh6 1lQdQlo2CnISmE3UzcCypmN4CKQeDaIEhVNuQ5QkmkjoH3ZvNgq6dwVeNJVGmyakJvvN PZBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11si2745409otm.312.2020.01.08.14.06.13; Wed, 08 Jan 2020 14:06:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbgAHWFZ (ORCPT + 99 others); Wed, 8 Jan 2020 17:05:25 -0500 Received: from muru.com ([72.249.23.125]:50508 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgAHWFZ (ORCPT ); Wed, 8 Jan 2020 17:05:25 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id B46DC80C5; Wed, 8 Jan 2020 22:06:04 +0000 (UTC) Date: Wed, 8 Jan 2020 14:05:20 -0800 From: Tony Lindgren To: Peter Ujfalusi Cc: Colin King , Dan Williams , Vinod Koul , dmaengine@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced Message-ID: <20200108220520.GJ5885@atomide.com> References: <20200106122325.39121-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peter Ujfalusi [200108 07:20]: > Colin, Tony, > > On 07/01/2020 13.59, Peter Ujfalusi wrote: > > Colin, > > > > On 06/01/2020 14.23, Colin King wrote: > >> From: Colin Ian King > >> > >> Currently when the call to dev_get_platdata returns null the driver issues > >> a warning and then later dereferences the null pointer. Avoid this issue > >> by returning -EPROBE_DEFER errror rather when the platform data is null. > > > > Thank you for noticing it! > > > > Acked-by: Peter Ujfalusi > > > >> Addresses-Coverity: ("Dereference after null check") > >> Fixes: 211010aeb097 ("dmaengine: ti: omap-dma: Pass sdma auxdata to driver and use it") > >> Signed-off-by: Colin Ian King > >> --- > >> drivers/dma/ti/omap-dma.c | 4 +++- > >> 1 file changed, 3 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c > >> index fc8f7b2fc7b3..335c3fa7a3b1 100644 > >> --- a/drivers/dma/ti/omap-dma.c > >> +++ b/drivers/dma/ti/omap-dma.c > >> @@ -1658,8 +1658,10 @@ static int omap_dma_probe(struct platform_device *pdev) > >> if (conf) { > >> od->cfg = conf; > >> od->plat = dev_get_platdata(&pdev->dev); > >> - if (!od->plat) > >> + if (!od->plat) { > >> dev_warn(&pdev->dev, "no sdma auxdata needed?\n"); > >> + return -EPROBE_DEFER; > > I think we should make the print as dev_err("&pdev->dev, > "omap_system_dma_plat_info is missing") and return with -ENODEV. The > omap_system_dma_plat_info is _needed_ and if we have booted with device > tree it is not going to appear later. > > Tony, what do you think? Yes makes sense, the auxdata is needed for the quirks for now. Eventually the quirks can be set directly in the dmaengine driver based on compatible and soc_device_match(). Regards, Tony