Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp744641ybh; Sat, 3 Aug 2019 08:55:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqziFppAXMwQ4moQed+XMXwWMBRTnRpTVBZxlakodflItC058Ux0ZFQ5FzzhVRFxhP4a1+ff X-Received: by 2002:a62:e901:: with SMTP id j1mr66383886pfh.189.1564847748986; Sat, 03 Aug 2019 08:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564847748; cv=none; d=google.com; s=arc-20160816; b=s1RKX8w76IM6Ta+VWVZl8A62R1ULLqbovO/Mp/RB22GGPV1z6ONKCsa8quGauWAO5w syFdNFZ5mDIqg3iG2U1SdbIrxwFQGmbmDLxNBWhHCr7BQMuok4rISJK7uHBnbbIx2yKp JQCfQSP+1PndM4ygIuOlZYswdisOAkEwlfj2s5hRwD7EL3TySdzsy/clxlqCCLrZOOuL sjtoat0D9i054Yb58JBpPzrmKwWxuz11/q6KWZeLeBC9PJSrSTX2tQ5zKmE0p+jGzYTq a10O/S0QZzI0HXnEPIVmktiGZDxfb1Jf8togh197+EA8uOI80OZ6zBrjOuKMCOGV/vLQ jFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=TNUm0t3MLlH16KpyhggVaKUcPd2kbhbYXDGr9DBD1Bs=; b=Tf5G3dZWrXSor2bRxZay0UqY8sw14fbgxqJkUqfEpUJnCMQWtv2I6sOycOcSoWmyu1 LsYfVm6SwrFOk28X6NwLL04OCEHzkzvOJUtexzDNWcuqR78RyGY9kNlQwDBFoDnxYEsJ pNx4zKI/oYXWNTWiu35XOATK+783Hpx8t3a8rH5dXRGA7S0rW+EXw/uewgOJ66dDrTch pkIg0vqYAHzVVnKHsA6qk0Sm9fa7bhe5qmW0dqAYpGZxBCijjbGFqzYn9J8gFzotSOJy JjxmXNX6u1KdSJ6Vkh+BQPtC0zUfc0xksjIp2TVdHdftBka5HP/wHEHcCLqKAmEWnZAX zd1w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x131si43683173pfd.116.2019.08.03.08.55.34; Sat, 03 Aug 2019 08:55:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391440AbfHBQw3 (ORCPT + 99 others); Fri, 2 Aug 2019 12:52:29 -0400 Received: from mga05.intel.com ([192.55.52.43]:4984 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728856AbfHBQw3 (ORCPT ); Fri, 2 Aug 2019 12:52:29 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2019 09:52:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,338,1559545200"; d="scan'208";a="257031873" Received: from mvicidom-mobl.amr.corp.intel.com (HELO [10.254.92.34]) ([10.254.92.34]) by orsmga001.jf.intel.com with ESMTP; 02 Aug 2019 09:52:27 -0700 Subject: Re: [alsa-devel] [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params To: Vinod Koul 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 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> From: Pierre-Louis Bossart Message-ID: <884a13fc-08eb-10c9-de9c-50cf38ff533d@linux.intel.com> Date: Fri, 2 Aug 2019 11:52:26 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190802155738.GR12733@vkoul-mobl.Dlink> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.