lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4942f328-8bb6-9880-8901-0cae5ca73873@linux.intel.com>
Date:   Thu, 17 Nov 2022 15:37:41 +0200
From:   Péter Ujfalusi <peter.ujfalusi@...ux.intel.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Mark Brown <broonie@...nel.org>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
        Jyri Sarha <jyri.sarha@...el.com>,
        sound-open-firmware@...a-project.org, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org
Cc:     Liam Girdwood <lgirdwood@...il.com>,
        Bard Liao <yung-chuan.liao@...ux.intel.com>,
        Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
        Daniel Baluta <daniel.baluta@....com>,
        Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Subject: Re: [PATCH v1 1/1] ASoC: SOF: probes: Check ops before memory
 allocation



On 17/11/2022 12:32, Andy Shevchenko wrote:
> We may check ops before spending resources on memory allocation.

we might.

Acked-by: Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>

> While at it, utilize dev_get_platdata() helper.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  sound/soc/sof/sof-client-probes.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c
> index d08395182b1a..fff126808bc0 100644
> --- a/sound/soc/sof/sof-client-probes.c
> +++ b/sound/soc/sof/sof-client-probes.c
> @@ -399,23 +399,21 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev,
>  	if (!sof_probes_enabled)
>  		return -ENXIO;
>  
> -	if (!dev->platform_data) {
> +	ops = dev_get_platdata(dev);
> +	if (!ops) {
>  		dev_err(dev, "missing platform data\n");
>  		return -ENODEV;
>  	}
> -
> -	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv)
> -		return -ENOMEM;
> -
> -	ops = dev->platform_data;
> -
>  	if (!ops->startup || !ops->shutdown || !ops->set_params || !ops->trigger ||
>  	    !ops->pointer) {
>  		dev_err(dev, "missing platform callback(s)\n");
>  		return -ENODEV;
>  	}
>  
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
>  	priv->host_ops = ops;
>  
>  	switch (sof_client_get_ipc_type(cdev)) {

-- 
Péter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ