Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp781175ybh; Sat, 3 Aug 2019 09:39:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/nb2B4owvhahdVc9FYyQnXmlOm29wkpI/+CXwT3X8+AfZoZcl6CeQsI8qv9rLm/5xzjyC X-Received: by 2002:a17:902:3363:: with SMTP id a90mr14298672plc.119.1564850344314; Sat, 03 Aug 2019 09:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564850344; cv=none; d=google.com; s=arc-20160816; b=xPTnVijHjGqoxSufkG+821HZ+92m+knc0n/oDVfBG9T7mUU7C5Ji/o51XF5znlQa5y v/yyThL+ioS3l759QXR2aJjTjeTxZ/K/AQY7Cfr2UTxiDax67pdXidUN27I7No7j5Pcl 12TQL0wmlRHRawZmtxY+JNoG+f4wZ1TzSUHO6v58Cbijqk8kcVvpzA+rnNhrft4ONRmj AQfkLvuvl/odSjVyuswEHPce/NYvKfkpvtBQSJT3/+c3ihn0mScfmDR7rNq+m7oId2W9 2owXHlDzgj9cbmPHoFEzggvj3WRCFNaQvmKciL4Qkpc48cP75nH/flPyeCllXuzsBMVJ wYTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XWZw01dge3GlfsFNvhSIsVL9TNtu96u7SJbUrhbvEDs=; b=EHxmFbaaJEIQ3okiGcCtxFs+y4Ps+YLLENs2KM9s4TvVo/Z0SbiOz5WVmcIN2T1dS9 xNWYSyRBZvRt1Y8wwAf712HEo9Qve/IiMOsecp7BOzRgDgJVJ3JUhpbCYwVFRASGPUHt Ykgh1mAjhWYgy1/uDrZK5UJ5bq+aPRu0HPnudr5vsl6h8d+5ErQB861Rve9RCB1Y9Py0 EVI7GGbeawPE3TSmuJKYu2b/ErIQPi0gvjVNc9pOIFw+QJxULZH5264lygXH6sjKUa/0 LrpPTiZ/s6aPBYjRL6zv3IOD2iDHXGvVhH6+Ti/JqvXax3EfltTKwrQQOJBoMHvgQpQ/ gMLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1YRuXRZ2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si39467183pfr.11.2019.08.03.09.38.49; Sat, 03 Aug 2019 09:39:04 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=1YRuXRZ2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405669AbfHBRiq (ORCPT + 99 others); Fri, 2 Aug 2019 13:38:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:47726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729364AbfHBRiq (ORCPT ); Fri, 2 Aug 2019 13:38:46 -0400 Received: from localhost (unknown [106.51.106.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A8B32171F; Fri, 2 Aug 2019 17:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564767525; bh=JFlo0hd8b2cvmNPi8HS4NNA9dAnHWTxHjhwDFVTzlpI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1YRuXRZ2R+4pLMF8Lug3V25dSOvWufl7EejpqZTLSoid4tLvge3J8qYdX8iKCFuL/ OONHBsH0512YwnLTxQ6/VvfV56HGnj3Wbxu72/DHGfh59gBnWWPvczkkikZoeuDwrl SzT80OHXJACPyOufg374ip7DeDf8YIMtij8kglz0= Date: Fri, 2 Aug 2019 23:07:32 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale Subject: Re: [alsa-devel] [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params Message-ID: <20190802173732.GF12733@vkoul-mobl.Dlink> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-7-pierre-louis.bossart@linux.intel.com> <20190802115537.GI12733@vkoul-mobl.Dlink> <6da5aeef-40bf-c9bb-fc18-4ac0b3961857@linux.intel.com> <20190802155738.GR12733@vkoul-mobl.Dlink> <884a13fc-08eb-10c9-de9c-50cf38ff533d@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <884a13fc-08eb-10c9-de9c-50cf38ff533d@linux.intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02-08-19, 11:52, Pierre-Louis Bossart wrote: > > > On 8/2/19 10:57 AM, Vinod Koul wrote: > > On 02-08-19, 10:16, Pierre-Louis Bossart wrote: > > > > > > > > > On 8/2/19 6:55 AM, Vinod Koul wrote: > > > > On 25-07-19, 18:39, Pierre-Louis Bossart wrote: > > > > > This should not happen in production systems but we should test for > > > > > all callback arguments before invoking the config_stream callback. > > > > > > > > so you are saying callback arg is mandatory, if so please document that > > > > assumption > > > > > > no, what this says is that if a config_stream is provided then it needs to > > > have a valid argument. > > > > well typically args are not mandatory.. > > > > > I am not sure what you mean by "document that assumption", comment in the > > > code (where?) or SoundWire documentation? > > > > The callback documentation which in this is in include/linux/soundwire/sdw_intel.h > > > > /** > * struct sdw_intel_ops: Intel audio driver callback ops > * > * @config_stream: configure the stream with the hw_params > */ > struct sdw_intel_ops { > int (*config_stream)(void *arg, void *substream, > void *dai, void *hw_params, int stream_num); > }; > > all parameters are mandatory really, not sure what you are trying to get at. It would be good to make a note that argument is mandatory! Thanks -- ~Vinod